From 85a354f2fb079e024a5aa4facf4ee79e5b90440b Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Wed, 19 Nov 2014 19:28:34 +0530 Subject: [PATCH] fix Mailbox migration patch --- erpnext/patches/v4_4/make_email_accounts.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/erpnext/patches/v4_4/make_email_accounts.py b/erpnext/patches/v4_4/make_email_accounts.py index 950b2a6741..cf94107097 100644 --- a/erpnext/patches/v4_4/make_email_accounts.py +++ b/erpnext/patches/v4_4/make_email_accounts.py @@ -4,8 +4,8 @@ def execute(): frappe.reload_doc("email", "doctype", "email_account") # outgoing - if frappe.db.exists("DocType", "Outgoing Email Settings"): - outgoing = dict(frappe.db.sql("select field, value from tabSingles where doctype='Outgoing Email Settings'")) + outgoing = dict(frappe.db.sql("select field, value from tabSingles where doctype='Outgoing Email Settings'")) + if outgoing and outgoing['mail_server']: account = frappe.new_doc("Email Account") mapping = { "email_id": "mail_login", @@ -26,8 +26,8 @@ def execute(): account.insert() # support - if frappe.db.exists("DocType", "Support Email Settings"): - support = dict(frappe.db.sql("select field, value from tabSingles where doctype='Support Email Settings'")) + support = dict(frappe.db.sql("select field, value from tabSingles where doctype='Support Email Settings'")) + if support and support['mail_server']: account = frappe.new_doc("Email Account") mapping = { "enable_incoming": "sync_support_mails", @@ -50,8 +50,9 @@ def execute(): # sales, jobs for doctype in ("Sales Email Settings", "Jobs Email Settings"): - if frappe.db.exists("DocType", doctype): - source = dict(frappe.db.sql("select field, value from tabSingles where doctype=%s", doctype)) + source = dict(frappe.db.sql("select field, value from tabSingles where doctype=%s", doctype)) + print source + if source and source.get('host'): account = frappe.new_doc("Email Account") mapping = { "enable_incoming": "extract_emails",