fix: link Purchase Invoice and Receipt Items to Asset

This commit is contained in:
Khushi Rawat
2024-08-26 23:33:10 +05:30
parent 944479313c
commit 1121c6663f
8 changed files with 108 additions and 6 deletions

View File

@@ -1262,7 +1262,11 @@ class PurchaseInvoice(BuyingController):
def update_gross_purchase_amount_for_linked_assets(self, item):
assets = frappe.db.get_all(
"Asset",
filters={"purchase_invoice": self.name, "item_code": item.item_code},
filters={
"purchase_invoice": self.name,
"item_code": item.item_code,
"purchase_invoice_item": ("in", [item.name, ""]),
},
fields=["name", "asset_quantity"],
)
for asset in assets: