fix: Issues regarding asset cancellation and deletion

This commit is contained in:
Nabin Hait
2024-02-20 18:10:34 +05:30
parent efade9b9ae
commit 17f85de6fb
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"):