forked from frappe/erpnext
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request frappe#40121 from nabinhait/asset-cancel-deletion
fix: Patch to remove cancelled asset capitalization from asset
- Loading branch information
Showing
3 changed files
with
17 additions
and
1 deletion.
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
11 changes: 11 additions & 0 deletions
11
erpnext/patches/v15_0/remove_cancelled_asset_capitalization_from_asset.py
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,11 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
cancelled_asset_capitalizations = frappe.get_all( | ||
"Asset Capitalization", | ||
filters={"docstatus": 2}, | ||
fields=["name", "target_asset"], | ||
) | ||
for asset_capitalization in cancelled_asset_capitalizations: | ||
frappe.db.set_value("Asset", asset_capitalization.target_asset, "capitalized_in", None) |