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 9df527bf3f)
This commit is contained in:
Mihir Kandoi
2026-08-08 16:25:06 +05:30
committed by Mergify
parent e885902864
commit c598cf9010
2 changed files with 3 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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):