From 6c0c5702c503b84cfeb2a2b732a6a3f938f0cfad Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 May 2015 16:49:40 +0530 Subject: [PATCH] patch fix : replace fields in print formats and custom scripts --- ...named_fields_in_custom_scripts_and_print_formats.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 8e1dbd3a42..31747b86ec 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 @@ -46,12 +46,20 @@ def get_all_renamed_fields(): ) for fields in rename_map.values(): - renamed_fields += tuple(fields) + if fields[0] != "entries": + renamed_fields += tuple(fields) return renamed_fields def update_script(dt, name, script_field, script, renamed_fields): for from_field, to_field in renamed_fields: script = re.sub(r"\b{}\b".format(from_field), to_field, script) + + if dt == "Journal Entry": + script = re.sub(r"\bentries\b", "accounts", script) + elif dt == "Bank Reconciliation": + script = re.sub(r"\bentries\b", "journal_entries", script) + elif dt in ("Sales Invoice", "Purchase Invoice"): + script = re.sub(r"\bentries\b", "items", script) frappe.db.set_value(dt, name, script_field, script)