fix(manufacturing): show serial/batch reset message only when one was selected

An empty finished good row was also reported as reset, which hid the real problem when the work order created no serial nos or batches.

(cherry picked from commit eee37f44a9)
This commit is contained in:
Mihir Kandoi
2026-10-23 04:37:36 +00:00
committed by Mergify
parent 7f15b87e9b
commit 4a8f84d28c
@@ -308,13 +308,15 @@ class ManufactureStockEntry(BaseManufactureStockEntry):
continue
if self.check_invalid_serial_batch_nos_for_finished_good_item(row):
had_selection = row.serial_no or row.batch_no or row.serial_and_batch_bundle
self.reset_serial_batch_on_fg_row(row)
frappe.msgprint(
_(
"Row {0}: Serial/Batch has been reset to values linked with Work Order {1}"
" because the previously selected serial/batch does not belong to this Work Order."
).format(row.idx, frappe.bold(self.doc.work_order))
)
if had_selection:
frappe.msgprint(
_(
"Row {0}: Serial/Batch has been reset to values linked with Work Order {1}"
" because the previously selected serial/batch does not belong to this Work Order."
).format(row.idx, frappe.bold(self.doc.work_order))
)
def check_invalid_serial_batch_nos_for_finished_good_item(self, row) -> bool:
if self.wo_doc.has_serial_no: