[Fix] Unable to create production order from the sales order for the bundle items (#9976)

This commit is contained in:
rohitwaghchaure 2017-07-20 10:35:51 +05:30 committed by Makarand Bauskar
parent f86100a734
commit 79d6266c7b

View File

@ -326,11 +326,12 @@ class SalesOrder(SellingController):
bom = frappe.get_all('BOM', dict(item=i.item_code, is_active=True),
order_by='is_default desc')
bom = bom[0].name if bom else None
stock_qty = i.qty if self.packed_items else i.stock_qty
items.append(dict(
item_code= i.item_code,
bom = bom,
warehouse = i.warehouse,
pending_qty= i.stock_qty - flt(frappe.db.sql('''select sum(qty) from `tabProduction Order`
pending_qty= stock_qty - flt(frappe.db.sql('''select sum(qty) from `tabProduction Order`
where production_item=%s and sales_order=%s''', (i.item_code, self.name))[0][0])
))