mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 15:11:52 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user