chore: fix conflicts

This commit is contained in:
rohitwaghchaure
2026-01-23 12:27:37 +05:30
committed by GitHub
parent c8a52ec43c
commit 3489b65f1a

View File

@@ -1478,26 +1478,30 @@ class SerialandBatchBundle(Document):
def get_available_qty_from_sabb(self): def get_available_qty_from_sabb(self):
batches = [d.batch_no for d in self.entries if d.batch_no] batches = [d.batch_no for d in self.entries if d.batch_no]
parent = frappe.qb.DocType("Serial and Batch Bundle")
child = frappe.qb.DocType("Serial and Batch Entry") child = frappe.qb.DocType("Serial and Batch Entry")
query = ( query = (
frappe.qb.from_(child) frappe.qb.from_(parent)
.inner_join(child)
.on(parent.name == child.parent)
.select( .select(
child.batch_no, child.batch_no,
Sum(child.qty).as_("available_qty"), Sum(child.qty).as_("total_qty"),
) )
.where( .where(
(child.item_code == self.item_code) (parent.warehouse == self.warehouse)
& (child.warehouse == self.warehouse) & (parent.item_code == self.item_code)
& (child.is_cancelled == 0)
& (child.batch_no.isin(batches)) & (child.batch_no.isin(batches))
& (child.docstatus == 1) & (parent.docstatus == 1)
& (child.type_of_transaction.isin(["Inward", "Outward"])) & (parent.is_cancelled == 0)
& (parent.type_of_transaction.isin(["Inward", "Outward"]))
) )
.for_update() .for_update()
.groupby(child.batch_no) .groupby(child.batch_no)
) )
query = query.where(child.voucher_type != "Pick List")
query = query.where(parent.voucher_type != "Pick List")
res = query.run(as_list=True) res = query.run(as_list=True)