fix(ux): move `get_route_options_for_new_doc` to `refresh` (#37096)
fix: move `get_route_options_for_new_doc` to `refresh`
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 80d7b79..975adc2 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -134,15 +134,6 @@
}
}
});
-
- let sbb_field = this.frm.get_docfield('items', 'serial_and_batch_bundle');
- if (sbb_field) {
- sbb_field.get_route_options_for_new_doc = (row) => {
- return {
- 'item_code': row.doc.item_code,
- }
- };
- }
}
if(
@@ -207,15 +198,6 @@
});
}
- let batch_no_field = this.frm.get_docfield("items", "batch_no");
- if (batch_no_field) {
- batch_no_field.get_route_options_for_new_doc = function(row) {
- return {
- "item": row.doc.item_code
- }
- };
- }
-
if (this.frm.fields_dict["items"].grid.get_field('blanket_order')) {
this.frm.set_query("blanket_order", "items", function(doc, cdt, cdn) {
var item = locals[cdt][cdn];
@@ -268,6 +250,28 @@
}
]);
}
+
+ if(this.frm.fields_dict['items'].grid.get_field('serial_and_batch_bundle')) {
+ let sbb_field = this.frm.get_docfield('items', 'serial_and_batch_bundle');
+ if (sbb_field) {
+ sbb_field.get_route_options_for_new_doc = (row) => {
+ return {
+ 'item_code': row.doc.item_code,
+ }
+ };
+ }
+ }
+
+ if(this.frm.fields_dict['items'].grid.get_field('batch_no')) {
+ let batch_no_field = this.frm.get_docfield('items', 'batch_no');
+ if (batch_no_field) {
+ batch_no_field.get_route_options_for_new_doc = function(row) {
+ return {
+ 'item': row.doc.item_code
+ }
+ };
+ }
+ }
}
is_return() {
@@ -358,7 +362,6 @@
}
refresh() {
-
erpnext.toggle_naming_series();
erpnext.hide_company();
this.set_dynamic_labels();