-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
) feat: total_asset_cost field (backport #38879) (#38886) * feat: total_asset_cost field (#38879) (cherry picked from commit d370c60) # 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> (cherry picked from commit 8169c7d) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0c13cb8
commit a63b8df
Showing
4 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |