diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 3b01e7484cf..b32033c771b 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -316,6 +316,7 @@ def make_batch(args): @frappe.whitelist() def get_pos_reserved_batch_qty(filters): + from frappe.query_builder.functions import Sum import json if isinstance(filters, str): @@ -323,7 +324,7 @@ def get_pos_reserved_batch_qty(filters): p = frappe.qb.DocType("POS Invoice").as_("p") item = frappe.qb.DocType("POS Invoice Item").as_("item") - sum_qty = frappe.query_builder.functions.Sum(item.qty).as_("qty") + sum_qty = Sum(item.qty).as_("qty") reserved_batch_qty = frappe.qb.from_(p).from_(item).select(sum_qty).where( (p.name == item.parent) & @@ -337,4 +338,4 @@ def get_pos_reserved_batch_qty(filters): ).run() flt_reserved_batch_qty = flt(reserved_batch_qty[0][0]) - return flt_reserved_batch_qty \ No newline at end of file + return flt_reserved_batch_qty