Merge pull request #1612 from pdvyas/migrate-3to4
3 to 4 migration
diff --git a/erpnext/patches/4_0/remove_india_specific_fields.py b/erpnext/patches/4_0/remove_india_specific_fields.py
index 68592cb..3070959 100644
--- a/erpnext/patches/4_0/remove_india_specific_fields.py
+++ b/erpnext/patches/4_0/remove_india_specific_fields.py
@@ -6,6 +6,7 @@
from frappe.core.doctype.custom_field.custom_field import create_custom_field_if_values_exist
def execute():
+ frappe.db.sql("delete from tabDocField where parent='Salary Slip' and options='Grade'")
docfields = {
("Purchase Receipt", "challan_no"): frappe.get_meta("Purchase Receipt").get_field("challan_no"),
("Purchase Receipt", "challan_date"): frappe.get_meta("Purchase Receipt").get_field("challan_date"),
@@ -18,6 +19,8 @@
}
for (doctype, fieldname), df in docfields.items():
+ if not df:
+ continue
opts = df.as_dict()
if df.idx >= 2:
opts["insert_after"] = frappe.get_meta(doctype).get("fields")[df.idx - 2].fieldname
diff --git a/erpnext/patches/4_0/split_email_settings.py b/erpnext/patches/4_0/split_email_settings.py
index 40aad39..630e954 100644
--- a/erpnext/patches/4_0/split_email_settings.py
+++ b/erpnext/patches/4_0/split_email_settings.py
@@ -8,7 +8,7 @@
frappe.reload_doc("core", "doctype", "outgoing_email_settings")
frappe.reload_doc("support", "doctype", "support_email_settings")
- email_settings = frappe.get_doc("Email Settings")
+ email_settings = get_email_settings()
map_outgoing_email_settings(email_settings)
map_support_email_settings(email_settings)
frappe.delete_doc("Doctype", "Email Settings")
@@ -48,3 +48,9 @@
support_email_settings.save()
+def get_email_settings():
+ ret = {}
+ for field, value in frappe.db.sql("select field, value from tabSingles where doctype='Email Settings'"):
+ ret[field] = value
+ return ret
+
diff --git a/erpnext/patches/4_0/update_user_properties.py b/erpnext/patches/4_0/update_user_properties.py
index 2e224ce..dfec48b 100644
--- a/erpnext/patches/4_0/update_user_properties.py
+++ b/erpnext/patches/4_0/update_user_properties.py
@@ -86,7 +86,9 @@
where `tabEmployee Leave Approver`.parent=`tabEmployee`.name)
or ifnull(`reports_to`, '')!=''"""):
- frappe.get_doc("Employee", employee).save()
+ emp = frappe.get_doc("Employee", employee)
+ emp.ignore_links = True
+ emp.save()
def update_permissions():
# clear match conditions other than owner