BugFix: Production Planning Tool - get_raw_materials
This commit is contained in:
parent
cb39e0878e
commit
3f8f4ff6cd
@ -243,10 +243,10 @@ class DocType:
|
|||||||
"item_code": [qty_required, description, stock_uom, min_order_qty]
|
"item_code": [qty_required, description, stock_uom, min_order_qty]
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
bom_wise_item_details = {}
|
|
||||||
item_list = []
|
item_list = []
|
||||||
|
|
||||||
for bom, so_wise_qty in bom_dict.items():
|
for bom, so_wise_qty in bom_dict.items():
|
||||||
|
bom_wise_item_details = {}
|
||||||
if self.doc.use_multi_level_bom:
|
if self.doc.use_multi_level_bom:
|
||||||
# get all raw materials with sub assembly childs
|
# get all raw materials with sub assembly childs
|
||||||
for d in webnotes.conn.sql("""select fb.item_code,
|
for d in webnotes.conn.sql("""select fb.item_code,
|
||||||
|
@ -37,14 +37,14 @@ class DocType(BuyingController):
|
|||||||
|
|
||||||
for so_no in so_items.keys():
|
for so_no in so_items.keys():
|
||||||
for item in so_items[so_no].keys():
|
for item in so_items[so_no].keys():
|
||||||
already_indented = webnotes.conn.sql("""select sum(qty) from `tabMaterial Request Item`
|
already_indented = webnotes.conn.sql("""select sum(ifnull(qty, 0))
|
||||||
|
from `tabMaterial Request Item`
|
||||||
where item_code = %s and sales_order_no = %s and
|
where item_code = %s and sales_order_no = %s and
|
||||||
docstatus = 1 and parent != %s""", (item, so_no, self.doc.name))
|
docstatus = 1 and parent != %s""", (item, so_no, self.doc.name))
|
||||||
already_indented = already_indented and flt(already_indented[0][0]) or 0
|
already_indented = already_indented and flt(already_indented[0][0]) or 0
|
||||||
|
|
||||||
actual_so_qty = webnotes.conn.sql("""select sum(qty) from `tabSales Order Item`
|
actual_so_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabSales Order Item`
|
||||||
where parent = %s and item_code = %s and docstatus = 1
|
where parent = %s and item_code = %s and docstatus = 1""", (so_no, item))
|
||||||
group by parent""", (so_no, item))
|
|
||||||
actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
|
actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
|
||||||
|
|
||||||
if actual_so_qty and (flt(so_items[so_no][item]) + already_indented > actual_so_qty):
|
if actual_so_qty and (flt(so_items[so_no][item]) + already_indented > actual_so_qty):
|
||||||
|
Loading…
Reference in New Issue
Block a user