Merge pull request #39983 from nabinhait/asset-cancel-deletion

fix: Issues regarding asset cancellation and deletion
This commit is contained in:
Nabin Hait
2024-02-21 11:14:27 +05:30
committed by GitHub
7 changed files with 35 additions and 23 deletions

View File

@@ -824,7 +824,8 @@ class BuyingController(SubcontractingController):
if self.doctype == "Purchase Invoice" and not self.get("update_stock"):
return
frappe.db.sql("delete from `tabAsset Movement` where reference_name=%s", self.name)
asset_movement = frappe.db.get_value("Asset Movement", {"reference_name": self.name}, "name")
frappe.delete_doc("Asset Movement", asset_movement, force=1)
def validate_schedule_date(self):
if not self.get("items"):