[fix] email account patch fix and minor setup wizard fix
diff --git a/erpnext/patches/v4_4/make_email_accounts.py b/erpnext/patches/v4_4/make_email_accounts.py
index 09d1ccb..528fe08 100644
--- a/erpnext/patches/v4_4/make_email_accounts.py
+++ b/erpnext/patches/v4_4/make_email_accounts.py
@@ -1,4 +1,5 @@
import frappe
+from frappe.model import default_fields
def execute():
frappe.reload_doc("email", "doctype", "email_account")
@@ -45,7 +46,20 @@
account.enable_outgoing = 0
account.append_to = "Issue"
- account.insert()
+ try:
+ account.insert()
+ except frappe.NameError, e:
+ if e.args[0]=="Email Account":
+ existing_account = frappe.get_doc("Email Account", e.args[1])
+ for key, value in account.as_dict().items():
+ if not existing_account.get(key) and value and key not in default_fields:
+ existing_account.set(key, value)
+
+ existing_account.save()
+
+ else:
+ raise
+
# sales, jobs
for doctype in ("Sales Email Settings", "Jobs Email Settings"):
@@ -66,7 +80,18 @@
account.enable_outgoing = 0
account.append_to = "Lead" if doctype=="Sales Email Settings" else "Job Applicant"
- account.insert()
+ try:
+ account.insert()
+ except frappe.NameError, e:
+ if e.args[0]=="Email Account":
+ existing_account = frappe.get_doc("Email Account", e.args[1])
+ for key, value in account.as_dict().items():
+ if not existing_account.get(key) and value and key not in default_fields:
+ existing_account.set(key, value)
+
+ existing_account.save()
+ else:
+ raise
for doctype in ("Outgoing Email Settings", "Support Email Settings",
"Sales Email Settings", "Jobs Email Settings"):
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.js b/erpnext/setup/page/setup_wizard/setup_wizard.js
index b2acaa5..c1ec20d 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.js
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.js
@@ -326,6 +326,7 @@
slide.get_input("currency").on("change", function() {
var currency = slide.get_input("currency").val();
+ if (!currency) return;
frappe.model.with_doc("Currency", currency, function() {
frappe.provide("locals.:Currency." + currency);
var currency_doc = frappe.model.get_doc("Currency", currency);