Allow manufacturing order from SO with Packed Items that contains BOM's (#11947)

This commit is contained in:
Maxwell Morais 2017-12-12 07:16:16 -02:00 committed by Nabin Hait
parent 4e17fae63b
commit d06b7049c7

View File

@ -53,10 +53,13 @@ class ProductionOrder(Document):
if self.sales_order: if self.sales_order:
so = frappe.db.sql(""" so = frappe.db.sql("""
select so.name, so_item.delivery_date, so.project select so.name, so_item.delivery_date, so.project
from `tabSales Order` so, `tabSales Order Item` so_item from `tabSales Order` so
where so.name=%s and so.name=so_item.parent inner join `tabSales Order Item` so_item on so_item.parent = so.name
and so.docstatus = 1 and so_item.item_code=%s left join `tabProduct Bundle Item` pk_item on so_item.item_code = pk_item.parent
""", (self.sales_order, self.production_item), as_dict=1) where so.name=%s and so.docstatus = 1 and (
so_item.item_code=%s or
pk_item.item_code=%s )
""", (self.sales_order, self.production_item, self.production_item), as_dict=1)
if len(so): if len(so):
if not self.expected_delivery_date: if not self.expected_delivery_date: