feat: Show Required Qty as per BOM in Material Request Items
diff --git a/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json b/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json
index 8d67827..6c60bbd 100644
--- a/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json
+++ b/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json
@@ -11,6 +11,7 @@
"from_warehouse",
"warehouse",
"column_break_4",
+ "required_bom_qty",
"quantity",
"uom",
"projected_qty",
@@ -137,7 +138,9 @@
"fetch_from": "item_code.safety_stock",
"fieldname": "safety_stock",
"fieldtype": "Float",
- "label": "Safety Stock"
+ "label": "Safety Stock",
+ "no_copy": 1,
+ "read_only": 1
},
{
"fieldname": "ordered_qty",
@@ -152,11 +155,18 @@
"label": "Reserved Qty for Production",
"no_copy": 1,
"read_only": 1
+ },
+ {
+ "fieldname": "required_bom_qty",
+ "fieldtype": "Float",
+ "label": "Required Qty as per BOM",
+ "no_copy": 1,
+ "read_only": 1
}
],
"istable": 1,
"links": [],
- "modified": "2021-03-22 12:11:10.993737",
+ "modified": "2021-03-26 12:41:13.013149",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Material Request Plan Item",
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.js b/erpnext/manufacturing/doctype/production_plan/production_plan.js
index cf89265..15ec620 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.js
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.js
@@ -251,7 +251,7 @@
get_items_for_material_requests: function(frm, warehouses) {
const set_fields = ['actual_qty', 'item_code','item_name', 'description', 'uom', 'from_warehouse',
- 'min_order_qty', 'quantity', 'sales_order', 'warehouse', 'projected_qty', 'ordered_qty',
+ 'min_order_qty', 'required_bom_qty', 'quantity', 'sales_order', 'warehouse', 'projected_qty', 'ordered_qty',
'reserved_qty_for_production', 'material_request_type'];
frappe.call({
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index e741d90..109c8b5 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -434,14 +434,14 @@
if isinstance(doc, string_types):
doc = frappe._dict(json.loads(doc))
- item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Warehouse',
+ item_list = [['Item Code', 'Description', 'Stock UOM', 'Warehouse', 'Required Qty as per BOM',
'Projected Qty', 'Actual Qty', 'Ordered Qty', 'Reserved Qty for Production',
- 'Safety Stock']]
+ 'Safety Stock', 'Required Qty']]
for d in get_items_for_material_requests(doc):
- item_list.append([d.get('item_code'), d.get('description'), d.get('stock_uom'), d.get('quantity'),
- d.get('warehouse'), d.get('projected_qty'), d.get('actual_qty'), d.get('ordered_qty'),
- d.get('reserved_qty_for_production'), d.get('safety_stock')])
+ item_list.append([d.get('item_code'), d.get('description'), d.get('stock_uom'), d.get('warehouse'),
+ d.get('required_bom_qty'), d.get('projected_qty'), d.get('actual_qty'), d.get('ordered_qty'),
+ d.get('reserved_qty_for_production'), d.get('safety_stock'), d.get('quantity')])
if not doc.get('for_warehouse'):
row = {'item_code': d.get('item_code')}
@@ -449,9 +449,9 @@
if d.get("warehouse") == bin_dict.get('warehouse'):
continue
- item_list.append(['', '', '', '', bin_dict.get('warehouse'),
- bin_dict.get('projected_qty', 0), bin_dict.get('actual_qty', 0)],
- bin_dict.get('ordered_qty', 0), bin_dict.get('reserved_qty_for_production', 0))
+ item_list.append(['', '', '', bin_dict.get('warehouse'), '',
+ bin_dict.get('projected_qty', 0), bin_dict.get('actual_qty', 0),
+ bin_dict.get('ordered_qty', 0), bin_dict.get('reserved_qty_for_production', 0)])
build_csv_response(item_list, doc.name)
@@ -554,6 +554,7 @@
'item_code': row.item_code,
'item_name': row.item_name,
'quantity': required_qty,
+ 'required_bom_qty': total_qty,
'description': row.description,
'stock_uom': row.get("stock_uom"),
'warehouse': warehouse or row.get('source_warehouse') \