fix(sales_order.py): handle zero bundle qty

This commit is contained in:
Rushabh Mehta 2019-03-06 14:42:50 +05:30
parent fb491a568f
commit 29c46bb311

View File

@ -282,6 +282,10 @@ class WorkOrder(Document):
total_bundle_qty = frappe.db.sql(""" select sum(qty) from
`tabProduct Bundle Item` where parent = %s""", (frappe.db.escape(self.product_bundle_item)))[0][0]
if not total_bundle_qty:
# product bundle is 0 (product bundle allows 0 qty for items)
total_bundle_qty = 1
cond = "product_bundle_item = %s" if self.product_bundle_item else "production_item = %s"
qty = frappe.db.sql(""" select sum(qty) from