feat: Show Required Qty as per BOM in Material Request Items

This commit is contained in:
Rucha Mahabal 2021-03-26 13:39:35 +05:30
parent 4cd68cdecb
commit 44853da7c2
3 changed files with 22 additions and 11 deletions

View File

@ -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",

View File

@ -251,7 +251,7 @@ frappe.ui.form.on('Production Plan', {
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({

View File

@ -434,14 +434,14 @@ def download_raw_materials(doc):
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 @@ def download_raw_materials(doc):
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 @@ def get_material_request_items(row, sales_order, company,
'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') \