diff --git a/erpnext/patches/v5_0/replace_renamed_fields_in_custom_scripts_and_print_formats.py b/erpnext/patches/v5_0/replace_renamed_fields_in_custom_scripts_and_print_formats.py index 31747b86ec..1500690d63 100644 --- a/erpnext/patches/v5_0/replace_renamed_fields_in_custom_scripts_and_print_formats.py +++ b/erpnext/patches/v5_0/replace_renamed_fields_in_custom_scripts_and_print_formats.py @@ -16,6 +16,9 @@ def execute(): for name, script in frappe.db.sql("select name, {0} as script from `tab{1}` where ({2}) {3}".format(script_field, dt, cond1, cond2)): update_script(dt, name, script_field, script, renamed_fields) + + # update fieldnames in property setter for idx + update_idx_property(renamed_fields) def get_all_renamed_fields(): from erpnext.patches.v5_0.rename_table_fieldnames import rename_map @@ -63,3 +66,20 @@ def update_script(dt, name, script_field, script, renamed_fields): script = re.sub(r"\bentries\b", "items", script) frappe.db.set_value(dt, name, script_field, script) + +def update_idx_property(renamed_fields): + for ps, ordered_fields, dt in frappe.db.sql("select name, value, doc_type from `tabProperty Setter` where property = '_idx'"): + for from_field, to_field in renamed_fields: + if from_field in ordered_fields: + ordered_fields[ordered_fields.index(from_field)] = to_field + + # remove invalid fields + valid_fields = [f.fieldname for f in frappe.get_meta(dt).fields] + for fld in ordered_fields: + if fld not in valid_fields: + ordered_fields.pop(fld) + + frappe.db.set_value("Property Setter", ps, "value", ordered_fields) + + + frappe.db.sql("delete from `tabProperty Setter` where `property` = 'idx'") \ No newline at end of file diff --git a/erpnext/patches/v5_0/set_footer_address.py b/erpnext/patches/v5_0/set_footer_address.py index 2779e48c59..a3324a0455 100644 --- a/erpnext/patches/v5_0/set_footer_address.py +++ b/erpnext/patches/v5_0/set_footer_address.py @@ -4,4 +4,5 @@ def execute(): frappe.reload_doctype("System Settings") ss = frappe.get_doc("System Settings", "System Settings") ss.email_footer_address = frappe.db.get_default("company") + ss.flags.ignore_mandatory = True ss.save()