Merge pull request #1310 from rmehta/email-account-fix

[minor] send_notification_to should be mandatory if notify_if_unreplied is set
This commit is contained in:
Anand Doshi 2015-09-21 11:42:51 +05:30
commit 7013a1b3e8
3 changed files with 9 additions and 2 deletions

View file

@ -41,12 +41,16 @@ frappe.ui.form.on("Email Account", {
enable_incoming: function(frm) {
frm.set_df_property("append_to", "reqd", frm.doc.enable_incoming);
},
notify_if_unreplied: function(frm) {
frm.set_df_property("send_notification_to", "reqd", frm.doc.notify_if_unreplied);
},
onload: function(frm) {
frm.set_df_property("append_to", "only_select", true);
frm.set_query("append_to", "frappe.email.doctype.email_account.email_account.get_append_to");
},
refresh: function(frm) {
frm.set_df_property("append_to", "reqd", frm.doc.enable_incoming);
frm.events.enable_incoming(frm);
frm.events.notify_if_unreplied(frm);
}
});

View file

@ -382,6 +382,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "30",
"depends_on": "notify_if_unreplied",
"fieldname": "unreplied_for_mins",
"fieldtype": "Int",
@ -779,7 +780,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-07-28 16:18:12.116327",
"modified": "2015-09-18 01:34:31.784444",
"modified_by": "Administrator",
"module": "Email",
"name": "Email Account",

View file

@ -54,6 +54,8 @@ class EmailAccount(Document):
self.check_smtp()
if self.notify_if_unreplied:
if not self.send_notification_to:
frappe.throw(_("{0} is mandatory").format(self.meta.get_label("send_notification_to")))
for e in self.get_unreplied_notification_emails():
validate_email_add(e, True)