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

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

(cherry picked from commit ed8a8532e1)

Co-authored-by: Khushi Rawat <142375893+khushi8112@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2025-04-24 16:36:53 +05:30
committed by GitHub
parent c140fd0f12
commit 4a29a54804
2 changed files with 11 additions and 5 deletions

View File

@@ -512,6 +512,7 @@
"fieldname": "total_asset_cost",
"fieldtype": "Currency",
"label": "Total Asset Cost",
"no_copy": 1,
"options": "Company:company:default_currency",
"read_only": 1
},
@@ -520,6 +521,7 @@
"fieldname": "additional_asset_cost",
"fieldtype": "Currency",
"label": "Additional Asset Cost",
"no_copy": 1,
"options": "Company:company:default_currency",
"read_only": 1
},
@@ -593,7 +595,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

@@ -98,9 +98,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()
@@ -139,9 +141,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")