Email settings check on save
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 0000000..bfe3efe
--- /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 2193207..d56ba2f 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -45,4 +45,9 @@
'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 4c45a77..c5e6a8e 100644
--- a/erpnext/setup/doctype/email_settings/email_settings.py
+++ b/erpnext/setup/doctype/email_settings/email_settings.py
@@ -71,7 +71,7 @@
"""
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