From e20c1acb6ee377252aaa295d384e2e1d7646252a Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Thu, 12 Oct 2023 16:54:41 +0530 Subject: [PATCH] fix: check child rows before update --- erpnext/controllers/accounts_controller.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 1a97245c21d..c250756d4f0 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -3458,17 +3458,14 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil def check_if_child_table_updated( child_table_before_update, child_table_after_update, fields_to_check ): - accounting_dimensions = get_accounting_dimensions() + ["cost_center", "project"] + fields_to_check = list(fields_to_check) + get_accounting_dimensions() + ["cost_center", "project"] + # Check if any field affecting accounting entry is altered - for index, item in enumerate(child_table_after_update): + for index, item in enumerate(child_table_before_update): for field in fields_to_check: if child_table_before_update[index].get(field) != item.get(field): return True - for dimension in accounting_dimensions: - if child_table_before_update[index].get(dimension) != item.get(dimension): - return True - return False