From ecdc4c8e9ba2eb345e7443ca8271957b4de6851e Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Thu, 8 Feb 2024 16:36:30 +0530 Subject: [PATCH] feat: add patch for making repostable dimension fields editable --- erpnext/patches.txt | 1 + ...on_submit_dimensions_for_repostable_doctypes.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 erpnext/patches/v15_0/allow_on_submit_dimensions_for_repostable_doctypes.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 4ead7e71f0..63ba2f8f8b 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -353,6 +353,7 @@ execute:frappe.db.set_single_value("Buying Settings", "project_update_frequency" execute:frappe.db.set_default("date_format", frappe.db.get_single_value("System Settings", "date_format")) erpnext.patches.v14_0.update_total_asset_cost_field erpnext.patches.v15_0.create_advance_payment_status +erpnext.patches.v15_0.allow_on_submit_dimensions_for_repostable_doctypes # below migration patch should always run last erpnext.patches.v14_0.migrate_gl_to_payment_ledger erpnext.stock.doctype.delivery_note.patches.drop_unused_return_against_index # 2023-12-20 diff --git a/erpnext/patches/v15_0/allow_on_submit_dimensions_for_repostable_doctypes.py b/erpnext/patches/v15_0/allow_on_submit_dimensions_for_repostable_doctypes.py new file mode 100644 index 0000000000..e75610d0a5 --- /dev/null +++ b/erpnext/patches/v15_0/allow_on_submit_dimensions_for_repostable_doctypes.py @@ -0,0 +1,14 @@ +import frappe + +from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( + get_accounting_dimensions, +) +from erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger import ( + get_allowed_types_from_settings, +) + + +def execute(): + for dt in get_allowed_types_from_settings(): + for dimension in get_accounting_dimensions(): + frappe.db.set_value("Custom Field", dt + "-" + dimension, "allow_on_submit", 1)