mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
* feat: total_asset_cost field (#38879)
(cherry picked from commit d370c60a6c)
# Conflicts:
# erpnext/assets/doctype/asset/asset.json
# erpnext/assets/doctype/asset/asset.py
# erpnext/patches.txt
* chore: resolve conflicts in asset.json
* chore: resolve conflicts in asset.py
* chore: resolve conflicts in patches.txt
---------
Co-authored-by: Anand Baburajan <anandbaburajan@gmail.com>
This commit is contained in:
17
erpnext/patches/v14_0/update_total_asset_cost_field.py
Normal file
17
erpnext/patches/v14_0/update_total_asset_cost_field.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
asset = frappe.qb.DocType("Asset")
|
||||
frappe.qb.update(asset).set(asset.total_asset_cost, asset.gross_purchase_amount).run()
|
||||
|
||||
asset_repair_list = frappe.db.get_all(
|
||||
"Asset Repair",
|
||||
filters={"docstatus": 1, "repair_status": "Completed", "capitalize_repair_cost": 1},
|
||||
fields=["asset", "repair_cost"],
|
||||
)
|
||||
|
||||
for asset_repair in asset_repair_list:
|
||||
frappe.qb.update(asset).set(
|
||||
asset.total_asset_cost, asset.total_asset_cost + asset_repair.repair_cost
|
||||
).where(asset.name == asset_repair.asset).run()
|
||||
Reference in New Issue
Block a user