fix(Asset Repair): Change controller hooks

This commit is contained in:
GangaManoj 2021-06-24 14:56:34 +05:30
parent 81bcae7433
commit cba0966ec5

View File

@ -35,7 +35,7 @@ class AssetRepair(AccountsController):
total_value_of_stock_consumed = self.get_total_value_of_stock_consumed() total_value_of_stock_consumed = self.get_total_value_of_stock_consumed()
self.total_repair_cost += total_value_of_stock_consumed self.total_repair_cost += total_value_of_stock_consumed
def on_submit(self): def before_submit(self):
self.check_repair_status() self.check_repair_status()
if self.get('stock_consumption') or self.get('capitalize_repair_cost'): if self.get('stock_consumption') or self.get('capitalize_repair_cost'):
@ -52,7 +52,7 @@ class AssetRepair(AccountsController):
self.asset_doc.prepare_depreciation_data() self.asset_doc.prepare_depreciation_data()
self.asset_doc.save() self.asset_doc.save()
def on_cancel(self): def before_cancel(self):
self.asset_doc = frappe.get_doc('Asset', self.asset) self.asset_doc = frappe.get_doc('Asset', self.asset)
if self.get('stock_consumption') or self.get('capitalize_repair_cost'): if self.get('stock_consumption') or self.get('capitalize_repair_cost'):