From 69cfc5566a5057851ca87030768323e86c8fb3e0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 30 Jan 2012 11:54:59 +0530 Subject: [PATCH] Email settings check on save --- .../patches/jan_mar_2012/email_settings_reload.py | 13 +++++++++++++ erpnext/patches/patch_list.py | 5 +++++ .../setup/doctype/email_settings/email_settings.py | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/jan_mar_2012/email_settings_reload.py diff --git a/erpnext/patches/jan_mar_2012/email_settings_reload.py b/erpnext/patches/jan_mar_2012/email_settings_reload.py new file mode 100644 index 0000000000..bfe3efeae9 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/email_settings_reload.py @@ -0,0 +1,13 @@ +def execute(): + """ + * Change type of mail_port field to int + * reload email settings + """ + import webnotes + webnotes.conn.sql(""" + UPDATE `tabDocField` SET fieldtype='Int' + WHERE parent = 'Email Settings' AND fieldname = 'mail_port' + """) + + from webnotes.modules.module_manager import reload_doc + reload_doc('setup', 'doctype', 'email_settings') diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 2193207837..d56ba2f847 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -45,4 +45,9 @@ patch_list = [ 'patch_file': 'doclabel_in_doclayer', 'description': "Show DocType Labels instead of DocType names in Customize Form View" }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'email_settings_reload', + 'description': "Change type of mail_port field to Int and reload email_settings doctype" + }, ] diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py index 4c45a77daf..c5e6a8e6a1 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.py +++ b/erpnext/setup/doctype/email_settings/email_settings.py @@ -71,7 +71,7 @@ class DocType: """ Checks support ticket email settings """ - if self.doc.support_host: + if self.doc.sync_support_mails and self.doc.support_host: from webnotes.utils.email_lib.receive import POP3Mailbox from webnotes.model.doc import Document import _socket, poplib