From 0a0272763808a85e9eefabd5a32b214eba5a79f2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 29 May 2026 04:03:30 +0530 Subject: [PATCH] fix: move ignore_linked_doctypes assignment to on_cancel in AssetRepair Semgrep rule frappe-modifying-but-not-comitting-other-method flags setting self.ignore_linked_doctypes inside make_gl_entries() instead of in the calling on_cancel method. Follows the same pattern used by AssetCapitalization. --- erpnext/assets/doctype/asset_repair/asset_repair.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.py b/erpnext/assets/doctype/asset_repair/asset_repair.py index 6347379d577..eb2a5e68c59 100644 --- a/erpnext/assets/doctype/asset_repair/asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/asset_repair.py @@ -218,6 +218,7 @@ class AssetRepair(AccountsController): def on_cancel(self): self.asset_doc = frappe.get_doc("Asset", self.asset) if self.get("capitalize_repair_cost"): + self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry") self.update_asset_value() self.make_gl_entries(cancel=True) self.set_increase_in_asset_life() @@ -306,9 +307,6 @@ class AssetRepair(AccountsController): ) def make_gl_entries(self, cancel=False): - if cancel: - self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry") - if flt(self.total_repair_cost) > 0: gl_entries = self.get_gl_entries() make_gl_entries(gl_entries, cancel)