From c598cf9010b41f1549c0b3f2fd2a5c562f0b9fa8 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sat, 8 Aug 2026 16:25:06 +0530 Subject: [PATCH] fix: keep Target Warehouse optional for work orders tracking semi finished goods The WIP warehouse change also removed the Target Warehouse exemption for semi FG orders, but those may validly carry the target on each operation instead. Restore the exemption in the form and the submit check; the WIP warehouse requirement stays. (cherry picked from commit 9df527bf3f98ceeac4545b17452d5b9e010d104a) --- erpnext/manufacturing/doctype/work_order/work_order.js | 3 ++- erpnext/manufacturing/doctype/work_order/work_order.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index 9992c2466fd..04f259f1508 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -281,7 +281,8 @@ frappe.ui.form.on("Work Order", { }, set_fg_warehouse_mandatory(frm) { - frm.toggle_reqd("fg_warehouse", frm.doc.skip_transfer !== 1); + let mandatory = frm.doc.skip_transfer === 1 || frm.doc.track_semi_finished_goods === 1 ? false : true; + frm.toggle_reqd("fg_warehouse", mandatory); }, add_custom_button_to_return_components: function (frm) { diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index a1fd433ad22..30ed33a66a4 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -917,7 +917,7 @@ class WorkOrder(Document): def validate_warehouse(self): 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: + if not self.fg_warehouse and not self.track_semi_finished_goods: frappe.throw(_("Target Warehouse is required before Submit")) def before_submit(self):