瀏覽代碼

refactor(minor): email.make API

* Avoid double save if possible - seemed like it was added mistakenly,
  didnt find enough evidence for it's addition
* Avoid json.loads breaking if "" was passed for attachments
version-14
Gavin D'souza 3 年之前
父節點
當前提交
487ff091c8
共有 1 個文件被更改,包括 3 次插入6 次删除
  1. +3
    -6
      frappe/core/doctype/communication/email.py

+ 3
- 6
frappe/core/doctype/communication/email.py 查看文件

@@ -76,16 +76,13 @@ def make(doctype=None, name=None, content=None, subject=None, sent_or_received =
"message_id":get_message_id().strip(" <>"),
"read_receipt":read_receipt,
"has_attachment": 1 if attachments else 0,
"communication_type": communication_type
"communication_type": communication_type,
}).insert(ignore_permissions=True)

comm.save(ignore_permissions=True)

if isinstance(attachments, str):
attachments = json.loads(attachments)

# if not committed, delayed task doesn't find the communication
if attachments:
if isinstance(attachments, str):
attachments = json.loads(attachments)
add_attachments(comm.name, attachments)

if cint(send_email):


Loading…
取消
儲存