mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 23:18:40 +00:00
fix: update BOM operations when routing is changed
The routing field handler only fetched operations from the routing when
the operations table was empty. When a new BOM version is created (via
"New Version"), operations are copied from the source BOM, so selecting a
different routing left the old operations in place - both in the form and
after saving.
Drop the `!frm.doc.operations.length` guard from the routing handler so
that (re)selecting a routing always refetches the operations from that
routing via the existing get_routing method, which clears and repopulates
the operations table.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 758a837de4)
This commit is contained in:
@@ -586,7 +586,11 @@ frappe.ui.form.on("BOM", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
routing(frm) {
|
routing(frm) {
|
||||||
if (frm.doc.routing && frm.doc.with_operations && !frm.doc.operations.length) {
|
// Refetch operations whenever the routing is (re)selected, so that
|
||||||
|
// changing the routing - e.g. on a new BOM version copied from another
|
||||||
|
// BOM - replaces the operations with those of the newly selected routing
|
||||||
|
// instead of keeping the old ones.
|
||||||
|
if (frm.doc.routing && frm.doc.with_operations) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
doc: frm.doc,
|
doc: frm.doc,
|
||||||
method: "get_routing",
|
method: "get_routing",
|
||||||
|
|||||||
Reference in New Issue
Block a user