fix: optimized query (#19026)

Co-authored-by: nabinhait
Co-authored-by: sahil28297 <sahilkhan28297@gmail.com>
This commit is contained in:
Shivam Mishra 2019-09-12 17:28:38 +05:30 committed by Nabin Hait
parent 504e52ff46
commit a3095c987a

View File

@ -1173,7 +1173,7 @@ class StockEntry(StockController):
frappe.db.sql("""UPDATE `tabPurchase Order Item Supplied` pos
SET pos.supplied_qty = (SELECT ifnull(sum(transfer_qty), 0) FROM `tabStock Entry Detail` sed
WHERE pos.name = sed.po_detail and sed.docstatus = 1)
WHERE pos.docstatus = 1""")
WHERE pos.docstatus = 1 and pos.parent = %s""", self.purchase_order)
#Update reserved sub contracted quantity in bin based on Supplied Item Details and
for d in self.get("items"):