PP Tool: Create production order if applicable for item
This commit is contained in:
parent
6c4085fc0c
commit
f18bbcef86
@ -185,20 +185,22 @@ class ProductionPlanningTool(Document):
|
|||||||
"""
|
"""
|
||||||
item_dict, bom_dict = {}, {}
|
item_dict, bom_dict = {}, {}
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
|
if d.bom_no:
|
||||||
item_dict[(d.item_code, d.sales_order, d.warehouse)] = {
|
bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
|
||||||
"production_item" : d.item_code,
|
if frappe.db.get_value("Item", d.item_code, "is_pro_applicable") == "Yes":
|
||||||
"sales_order" : d.sales_order,
|
item_dict[(d.item_code, d.sales_order, d.warehouse)] = {
|
||||||
"qty" : flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),
|
"production_item" : d.item_code,
|
||||||
{}).get("qty")) + flt(d.planned_qty),
|
"sales_order" : d.sales_order,
|
||||||
"bom_no" : d.bom_no,
|
"qty" : flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),
|
||||||
"description" : d.description,
|
{}).get("qty")) + flt(d.planned_qty),
|
||||||
"stock_uom" : d.stock_uom,
|
"bom_no" : d.bom_no,
|
||||||
"company" : self.company,
|
"description" : d.description,
|
||||||
"wip_warehouse" : "",
|
"stock_uom" : d.stock_uom,
|
||||||
"fg_warehouse" : d.warehouse,
|
"company" : self.company,
|
||||||
"status" : "Draft",
|
"wip_warehouse" : "",
|
||||||
}
|
"fg_warehouse" : d.warehouse,
|
||||||
|
"status" : "Draft",
|
||||||
|
}
|
||||||
return bom_dict, item_dict
|
return bom_dict, item_dict
|
||||||
|
|
||||||
def create_production_order(self, items):
|
def create_production_order(self, items):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user