Merge pull request #46944 from rohitwaghchaure/fixed-production=plan-lables

fix: production plan label description
This commit is contained in:
rohitwaghchaure
2025-04-16 23:17:55 +05:30
committed by GitHub
4 changed files with 20 additions and 13 deletions

View File

@@ -334,7 +334,7 @@ frappe.ui.form.on("Production Plan", {
frm.set_value("consider_minimum_order_qty", 0); frm.set_value("consider_minimum_order_qty", 0);
if (frm.doc.ignore_existing_ordered_qty) { if (!frm.doc.ignore_existing_ordered_qty) {
frm.events.get_items_for_material_requests(frm); frm.events.get_items_for_material_requests(frm);
} else { } else {
const title = __("Transfer Materials For Warehouse {0}", [frm.doc.for_warehouse]); const title = __("Transfer Materials For Warehouse {0}", [frm.doc.for_warehouse]);

View File

@@ -230,11 +230,11 @@
"label": "Include Subcontracted Items" "label": "Include Subcontracted Items"
}, },
{ {
"default": "0", "default": "1",
"description": "If enabled, the system will create material requests even if the stock exists in the 'Raw Materials Warehouse'.", "description": "If enabled, the system will consider items with a shortfall in quantity. \n<br>\nQty = Reqd Qty (BOM) - <a href=\"https://docs.frappe.io/erpnext/user/manual/en/projected-quantity\">Projected Qty</a>",
"fieldname": "ignore_existing_ordered_qty", "fieldname": "ignore_existing_ordered_qty",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Ignore Available Stock" "label": "Skip Available Raw Materials"
}, },
{ {
"fieldname": "column_break_25", "fieldname": "column_break_25",
@@ -249,7 +249,7 @@
{ {
"fieldname": "get_items_for_mr", "fieldname": "get_items_for_mr",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Get Raw Materials for Purchase" "label": "Get Items for Purchase Only"
}, },
{ {
"fieldname": "section_break_27", "fieldname": "section_break_27",
@@ -391,9 +391,10 @@
"label": "Consolidate Sub Assembly Items" "label": "Consolidate Sub Assembly Items"
}, },
{ {
"description": "If items in stock, proceed with Material Transfer or Purchase.",
"fieldname": "transfer_materials", "fieldname": "transfer_materials",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Get Raw Materials for Transfer" "label": "Get Items for Purchase / Transfer"
}, },
{ {
"collapsible": 1, "collapsible": 1,
@@ -402,8 +403,8 @@
"label": "Preview Required Materials" "label": "Preview Required Materials"
}, },
{ {
"default": "0", "default": "1",
"description": "If this checkbox is enabled, then the system won\u2019t run the MRP for the available sub-assembly items.", "description": "If enabled, the system will consider items with a shortfall in quantity. \n<br>\nQty = Reqd Qty (BOM) - <a href=\"https://docs.frappe.io/erpnext/user/manual/en/projected-quantity\">Projected Qty</a>",
"fieldname": "skip_available_sub_assembly_item", "fieldname": "skip_available_sub_assembly_item",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Skip Available Sub Assembly Items" "label": "Skip Available Sub Assembly Items"
@@ -436,11 +437,12 @@
"label": "Consider Minimum Order Qty" "label": "Consider Minimum Order Qty"
} }
], ],
"grid_page_length": 50,
"icon": "fa fa-calendar", "icon": "fa fa-calendar",
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2025-01-10 17:47:52.207209", "modified": "2025-04-08 17:24:09.394056",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Plan", "name": "Production Plan",
@@ -461,7 +463,8 @@
"write": 1 "write": 1
} }
], ],
"row_format": "Dynamic",
"sort_field": "creation", "sort_field": "creation",
"sort_order": "ASC", "sort_order": "ASC",
"states": [] "states": []
} }

View File

@@ -1329,7 +1329,7 @@ def get_material_request_items(
total_qty = row["qty"] total_qty = row["qty"]
required_qty = 0 required_qty = 0
if ignore_existing_ordered_qty or bin_dict.get("projected_qty", 0) < 0: if not ignore_existing_ordered_qty or bin_dict.get("projected_qty", 0) < 0:
required_qty = total_qty required_qty = total_qty
elif total_qty > bin_dict.get("projected_qty", 0): elif total_qty > bin_dict.get("projected_qty", 0):
required_qty = total_qty - bin_dict.get("projected_qty", 0) required_qty = total_qty - bin_dict.get("projected_qty", 0)
@@ -1688,7 +1688,7 @@ def get_items_for_material_requests(doc, warehouses=None, get_parent_warehouse_d
if items: if items:
mr_items.append(items) mr_items.append(items)
if (not ignore_existing_ordered_qty or get_parent_warehouse_data) and warehouses: if (ignore_existing_ordered_qty or get_parent_warehouse_data) and warehouses:
new_mr_items = [] new_mr_items = []
for item in mr_items: for item in mr_items:
get_materials_from_other_locations(item, warehouses, new_mr_items, company) get_materials_from_other_locations(item, warehouses, new_mr_items, company)

View File

@@ -180,7 +180,7 @@ class TestProductionPlan(IntegrationTestCase):
) )
pln = create_production_plan( pln = create_production_plan(
item_code="Test Production Item 1", use_multi_level_bom=0, ignore_existing_ordered_qty=0 item_code="Test Production Item 1", use_multi_level_bom=0, ignore_existing_ordered_qty=1
) )
self.assertFalse(len(pln.mr_items)) self.assertFalse(len(pln.mr_items))
@@ -725,6 +725,7 @@ class TestProductionPlan(IntegrationTestCase):
}, },
) )
pln.skip_available_sub_assembly_item = 0
pln.get_sub_assembly_items("In House") pln.get_sub_assembly_items("In House")
pln.submit() pln.submit()
pln.make_work_order() pln.make_work_order()
@@ -1454,6 +1455,7 @@ class TestProductionPlan(IntegrationTestCase):
) )
plan.for_warehouse = mrp_warhouse plan.for_warehouse = mrp_warhouse
plan.ignore_existing_ordered_qty = 1
items = get_items_for_material_requests( items = get_items_for_material_requests(
plan.as_dict(), warehouses=[{"warehouse": wh1}, {"warehouse": wh2}] plan.as_dict(), warehouses=[{"warehouse": wh1}, {"warehouse": wh2}]
@@ -1690,6 +1692,7 @@ class TestProductionPlan(IntegrationTestCase):
) )
pln.for_warehouse = rm_warehouse pln.for_warehouse = rm_warehouse
pln.ignore_existing_ordered_qty = 1
items = get_items_for_material_requests(pln.as_dict(), warehouses=[{"warehouse": store_warehouse}]) items = get_items_for_material_requests(pln.as_dict(), warehouses=[{"warehouse": store_warehouse}])
for row in items: for row in items:
@@ -1891,6 +1894,7 @@ class TestProductionPlan(IntegrationTestCase):
}, },
) )
plan.save() plan.save()
plan.ignore_existing_ordered_qty = 1
plan.get_sub_assembly_items() plan.get_sub_assembly_items()