diff --git a/erpnext/patches/4_0/remove_india_specific_fields.py b/erpnext/patches/4_0/remove_india_specific_fields.py index 68592cb463..3070959f34 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 @@ import frappe 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 @@ def execute(): } 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 40aad390b1..630e954c6e 100644 --- a/erpnext/patches/4_0/split_email_settings.py +++ b/erpnext/patches/4_0/split_email_settings.py @@ -8,7 +8,7 @@ def execute(): 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 @@ def map_support_email_settings(email_settings): 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 2e224ce91b..dfec48bb96 100644 --- a/erpnext/patches/4_0/update_user_properties.py +++ b/erpnext/patches/4_0/update_user_properties.py @@ -86,7 +86,9 @@ def add_employee_restrictions_to_leave_approver(): 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