From 24cd5f22b53d7903810649e208bdfe9869eefeee Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sat, 8 Aug 2026 14:43:22 +0530 Subject: [PATCH] fix: require WIP warehouse for work orders tracking semi finished goods Work orders with track_semi_finished_goods were exempt from the Work-in-Progress Warehouse requirement in three places: the field's mandatory_depends_on, the fg_warehouse reqd toggle in the form script, and validate_warehouse on submit. The exemption was misleading. The flow still transfers materials to a WIP warehouse when 'Skip Material Transfer' is unchecked: operations default their WIP warehouse from the work order, and set_default_warehouse silently restores the company default after the user clears the field. Make the field genuinely required instead of pretending it is optional. (cherry picked from commit 198eb60df7875d0e4ed300c259ddd1a866c8d418) --- erpnext/manufacturing/doctype/work_order/work_order.js | 3 +-- erpnext/manufacturing/doctype/work_order/work_order.json | 4 ++-- erpnext/manufacturing/doctype/work_order/work_order.py | 3 --- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index 04f259f1508..9992c2466fd 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -281,8 +281,7 @@ frappe.ui.form.on("Work Order", { }, set_fg_warehouse_mandatory(frm) { - let mandatory = frm.doc.skip_transfer === 1 || frm.doc.track_semi_finished_goods === 1 ? false : true; - frm.toggle_reqd("fg_warehouse", mandatory); + frm.toggle_reqd("fg_warehouse", frm.doc.skip_transfer !== 1); }, add_custom_button_to_return_components: function (frm) { diff --git a/erpnext/manufacturing/doctype/work_order/work_order.json b/erpnext/manufacturing/doctype/work_order/work_order.json index 04b970be3e1..cfe140726df 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.json +++ b/erpnext/manufacturing/doctype/work_order/work_order.json @@ -272,7 +272,7 @@ "fieldtype": "Link", "label": "Work-in-Progress Warehouse", "link_filters": "[[\"Warehouse\",\"disabled\",\"=\",0],[\"Warehouse\",\"is_group\",\"=\",0]]", - "mandatory_depends_on": "eval:(!doc.skip_transfer || doc.from_wip_warehouse) && !doc.track_semi_finished_goods", + "mandatory_depends_on": "eval:!doc.skip_transfer || doc.from_wip_warehouse", "options": "Warehouse" }, { @@ -739,7 +739,7 @@ "image_field": "image", "is_submittable": 1, "links": [], - "modified": "2026-06-03 21:35:34.175667", + "modified": "2026-08-08 12:00:00.000000", "modified_by": "Administrator", "module": "Manufacturing", "name": "Work Order", diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index eecf06b15c4..a1fd433ad22 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -915,9 +915,6 @@ class WorkOrder(Document): production_plan.run_method("update_produced_pending_qty", produced_qty, self.production_plan_item) def validate_warehouse(self): - if self.track_semi_finished_goods: - return - if not self.wip_warehouse and not self.skip_transfer: frappe.throw(_("Work-in-Progress Warehouse is required before Submit")) if not self.fg_warehouse: