diff --git a/core/doctype/communication/communication.py b/core/doctype/communication/communication.py index bb8db0c903..ccd26da198 100644 --- a/core/doctype/communication/communication.py +++ b/core/doctype/communication/communication.py @@ -35,6 +35,7 @@ class DocType(): else: parent.doc.status = "Open" + parent.ignore_permissions = True parent.ignore_mandatory = True parent.save() @@ -72,7 +73,9 @@ def make(doctype=None, name=None, content=None, subject=None, d.creation = date if doctype: sent_via = webnotes.get_obj(doctype, name) - d.fields[doctype.replace(" ", "_").lower()] = name + fieldname = doctype.replace(" ", "_").lower() + if comm.meta.get_field(fieldname): + d.fields[fieldname] = name if set_lead: set_lead_and_contact(d) @@ -135,10 +138,14 @@ def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', s if sent_via and hasattr(sent_via, 'on_communication_sent'): sent_via.on_communication_sent(d) - + def set_lead_and_contact(d): import email.utils email_addr = email.utils.parseaddr(d.sender) + + if webnotes.conn.get_value("Profile", email_addr[1], "user_type")=="System User": + email_addr = email.utils.parseaddr(d.recipients) + # set contact if not d.contact: d.contact = webnotes.conn.get_value("Contact", {"email_id": email_addr[1]}, diff --git a/public/js/wn/form/control.js b/public/js/wn/form/control.js index 193e940d52..d7d3fc18a8 100644 --- a/public/js/wn/form/control.js +++ b/public/js/wn/form/control.js @@ -225,7 +225,7 @@ wn.ui.form.ControlInput = wn.ui.form.Control.extend({ if(this.only_input || this.df.description===this._description) return; if(this.df.description) { - this.$wrapper.find(".help-box").html(this.df.description); + this.$wrapper.find(".help-box").html(wn._(this.df.description)); } else { this.set_empty_description(); } @@ -807,4 +807,4 @@ wn.ui.form.fieldtype_icons = { "Datetime": "icon-time", "Code": "icon-code", "Select": "icon-flag" -}; \ No newline at end of file +};