diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0c52a86ca39..e1d7e1f899e 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -434,3 +434,4 @@ erpnext.patches.v15_0.update_uae_zero_rated_fetch erpnext.patches.v15_0.add_company_payment_gateway_account erpnext.patches.v16_0.update_serial_no_reference_name erpnext.patches.v16_0.set_invoice_type_in_pos_settings +erpnext.patches.v15_0.update_fieldname_in_accounting_dimension_filter diff --git a/erpnext/patches/v15_0/update_fieldname_in_accounting_dimension_filter.py b/erpnext/patches/v15_0/update_fieldname_in_accounting_dimension_filter.py new file mode 100644 index 00000000000..50d3fbe6f9c --- /dev/null +++ b/erpnext/patches/v15_0/update_fieldname_in_accounting_dimension_filter.py @@ -0,0 +1,23 @@ +import frappe +from frappe.query_builder import DocType + + +def execute(): + ADF = DocType("Accounting Dimension Filter") + AD = DocType("Accounting Dimension") + + accounting_dimension_filter = ( + frappe.qb.from_(ADF) + .join(AD) + .on(AD.document_type == ADF.accounting_dimension) + .select(ADF.name, AD.fieldname) + ).run(as_dict=True) + + for doc in accounting_dimension_filter: + frappe.db.set_value( + "Accounting Dimension Filter", + doc.name, + "fieldname", + doc.fieldname, + update_modified=False, + )