feat: Show Required Qty as per BOM in Material Request Items
This commit is contained in:
parent
4cd68cdecb
commit
44853da7c2
@ -11,6 +11,7 @@
|
|||||||
"from_warehouse",
|
"from_warehouse",
|
||||||
"warehouse",
|
"warehouse",
|
||||||
"column_break_4",
|
"column_break_4",
|
||||||
|
"required_bom_qty",
|
||||||
"quantity",
|
"quantity",
|
||||||
"uom",
|
"uom",
|
||||||
"projected_qty",
|
"projected_qty",
|
||||||
@ -137,7 +138,9 @@
|
|||||||
"fetch_from": "item_code.safety_stock",
|
"fetch_from": "item_code.safety_stock",
|
||||||
"fieldname": "safety_stock",
|
"fieldname": "safety_stock",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"label": "Safety Stock"
|
"label": "Safety Stock",
|
||||||
|
"no_copy": 1,
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "ordered_qty",
|
"fieldname": "ordered_qty",
|
||||||
@ -152,11 +155,18 @@
|
|||||||
"label": "Reserved Qty for Production",
|
"label": "Reserved Qty for Production",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "required_bom_qty",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"label": "Required Qty as per BOM",
|
||||||
|
"no_copy": 1,
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-03-22 12:11:10.993737",
|
"modified": "2021-03-26 12:41:13.013149",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Material Request Plan Item",
|
"name": "Material Request Plan Item",
|
||||||
|
@ -251,7 +251,7 @@ frappe.ui.form.on('Production Plan', {
|
|||||||
|
|
||||||
get_items_for_material_requests: function(frm, warehouses) {
|
get_items_for_material_requests: function(frm, warehouses) {
|
||||||
const set_fields = ['actual_qty', 'item_code','item_name', 'description', 'uom', 'from_warehouse',
|
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'];
|
'reserved_qty_for_production', 'material_request_type'];
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
|
@ -434,14 +434,14 @@ def download_raw_materials(doc):
|
|||||||
if isinstance(doc, string_types):
|
if isinstance(doc, string_types):
|
||||||
doc = frappe._dict(json.loads(doc))
|
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',
|
'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):
|
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'),
|
item_list.append([d.get('item_code'), d.get('description'), d.get('stock_uom'), d.get('warehouse'),
|
||||||
d.get('warehouse'), d.get('projected_qty'), d.get('actual_qty'), d.get('ordered_qty'),
|
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('reserved_qty_for_production'), d.get('safety_stock'), d.get('quantity')])
|
||||||
|
|
||||||
if not doc.get('for_warehouse'):
|
if not doc.get('for_warehouse'):
|
||||||
row = {'item_code': d.get('item_code')}
|
row = {'item_code': d.get('item_code')}
|
||||||
@ -449,9 +449,9 @@ def download_raw_materials(doc):
|
|||||||
if d.get("warehouse") == bin_dict.get('warehouse'):
|
if d.get("warehouse") == bin_dict.get('warehouse'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
item_list.append(['', '', '', '', bin_dict.get('warehouse'),
|
item_list.append(['', '', '', bin_dict.get('warehouse'), '',
|
||||||
bin_dict.get('projected_qty', 0), bin_dict.get('actual_qty', 0)],
|
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))
|
bin_dict.get('ordered_qty', 0), bin_dict.get('reserved_qty_for_production', 0)])
|
||||||
|
|
||||||
build_csv_response(item_list, doc.name)
|
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_code': row.item_code,
|
||||||
'item_name': row.item_name,
|
'item_name': row.item_name,
|
||||||
'quantity': required_qty,
|
'quantity': required_qty,
|
||||||
|
'required_bom_qty': total_qty,
|
||||||
'description': row.description,
|
'description': row.description,
|
||||||
'stock_uom': row.get("stock_uom"),
|
'stock_uom': row.get("stock_uom"),
|
||||||
'warehouse': warehouse or row.get('source_warehouse') \
|
'warehouse': warehouse or row.get('source_warehouse') \
|
||||||
|
Loading…
Reference in New Issue
Block a user