fix: update additional cost and total asset cost after asset repair (#47233)

* fix: add consumed stock's cost to the asset value after repair

* fix: do not copy additional cost and total asset cost
This commit is contained in:
Khushi Rawat
2025-04-24 16:14:42 +05:30
committed by GitHub
parent 0d53e6ed7c
commit ed8a8532e1
2 changed files with 11 additions and 5 deletions

View File

@@ -478,6 +478,7 @@
"fieldname": "total_asset_cost",
"fieldtype": "Currency",
"label": "Total Asset Cost",
"no_copy": 1,
"options": "Company:company:default_currency",
"read_only": 1
},
@@ -486,6 +487,7 @@
"fieldname": "additional_asset_cost",
"fieldtype": "Currency",
"label": "Additional Asset Cost",
"no_copy": 1,
"options": "Company:company:default_currency",
"read_only": 1
},
@@ -589,7 +591,7 @@
"link_fieldname": "target_asset"
}
],
"modified": "2025-04-15 16:33:17.189524",
"modified": "2025-04-24 15:31:47.373274",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset",

View File

@@ -135,9 +135,11 @@ class AssetRepair(AccountsController):
self.increase_asset_value()
total_repair_cost = self.get_total_value_of_stock_consumed()
if self.capitalize_repair_cost:
self.asset_doc.total_asset_cost += self.repair_cost
self.asset_doc.additional_asset_cost += self.repair_cost
total_repair_cost += self.repair_cost
self.asset_doc.total_asset_cost += total_repair_cost
self.asset_doc.additional_asset_cost += total_repair_cost
if self.get("stock_consumption"):
self.check_for_stock_items_and_warehouse()
@@ -176,9 +178,11 @@ class AssetRepair(AccountsController):
self.decrease_asset_value()
total_repair_cost = self.get_total_value_of_stock_consumed()
if self.capitalize_repair_cost:
self.asset_doc.total_asset_cost -= self.repair_cost
self.asset_doc.additional_asset_cost -= self.repair_cost
total_repair_cost += self.repair_cost
self.asset_doc.total_asset_cost -= total_repair_cost
self.asset_doc.additional_asset_cost -= total_repair_cost
if self.get("capitalize_repair_cost"):
self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry")