Merge pull request #35739 from s-aga-r/FIX-35493
fix(ux): set route options for new `SBB`
diff --git a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js
index 96f4438..01fcb11 100644
--- a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js
+++ b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js
@@ -112,6 +112,17 @@
}
};
});
+
+ let sbb_field = me.frm.get_docfield('stock_items', 'serial_and_batch_bundle');
+ if (sbb_field) {
+ sbb_field.get_route_options_for_new_doc = (row) => {
+ return {
+ 'item_code': row.doc.item_code,
+ 'warehouse': row.doc.warehouse,
+ 'voucher_type': me.frm.doc.doctype,
+ }
+ };
+ }
}
target_item_code() {
diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.js b/erpnext/assets/doctype/asset_repair/asset_repair.js
index b2ab82c..dae993a 100644
--- a/erpnext/assets/doctype/asset_repair/asset_repair.js
+++ b/erpnext/assets/doctype/asset_repair/asset_repair.js
@@ -40,6 +40,16 @@
}
}
});
+
+ let sbb_field = frm.get_docfield('stock_items', 'serial_and_batch_bundle');
+ if (sbb_field) {
+ sbb_field.get_route_options_for_new_doc = (row) => {
+ return {
+ 'item_code': row.doc.item_code,
+ 'voucher_type': frm.doc.doctype,
+ }
+ };
+ }
},
refresh: function(frm) {
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.js b/erpnext/manufacturing/doctype/job_card/job_card.js
index 7d08aca..8e9f542 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.js
+++ b/erpnext/manufacturing/doctype/job_card/job_card.js
@@ -23,6 +23,17 @@
}
});
+ let sbb_field = frm.get_docfield('serial_and_batch_bundle');
+ if (sbb_field) {
+ sbb_field.get_route_options_for_new_doc = () => {
+ return {
+ 'item_code': frm.doc.production_item,
+ 'warehouse': frm.doc.wip_warehouse,
+ 'voucher_type': frm.doc.doctype,
+ }
+ };
+ }
+
frm.set_indicator_formatter('sub_operation',
function(doc) {
if (doc.status == "Pending") {
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 9335567..0d92683 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -134,6 +134,15 @@
}
}
});
+
+ 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(
diff --git a/erpnext/selling/doctype/installation_note/installation_note.js b/erpnext/selling/doctype/installation_note/installation_note.js
index d63060e..dd6f8a8 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.js
+++ b/erpnext/selling/doctype/installation_note/installation_note.js
@@ -18,6 +18,16 @@
}
}
});
+
+ let sbb_field = 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,
+ 'voucher_type': frm.doc.doctype,
+ }
+ };
+ }
},
onload: function(frm) {
if(!frm.doc.status) {
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 280485a..67c392c 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -46,6 +46,17 @@
}
}
});
+
+ let sbb_field = frm.get_docfield('packed_items', 'serial_and_batch_bundle');
+ if (sbb_field) {
+ sbb_field.get_route_options_for_new_doc = (row) => {
+ return {
+ 'item_code': row.doc.item_code,
+ 'warehouse': row.doc.warehouse,
+ 'voucher_type': frm.doc.doctype,
+ }
+ };
+ }
},
refresh: function(frm) {
diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js
index acbb62d..35c35a6 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.js
+++ b/erpnext/stock/doctype/pick_list/pick_list.js
@@ -65,6 +65,17 @@
}
}
});
+
+ let sbb_field = frm.get_docfield('locations', 'serial_and_batch_bundle');
+ if (sbb_field) {
+ sbb_field.get_route_options_for_new_doc = (row) => {
+ return {
+ 'item_code': row.doc.item_code,
+ 'warehouse': row.doc.warehouse,
+ 'voucher_type': frm.doc.doctype,
+ }
+ };
+ }
},
set_item_locations:(frm, save) => {
if (!(frm.doc.locations && frm.doc.locations.length)) {
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 3d497ac..403e04a 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -115,6 +115,15 @@
}
});
+ let sbb_field = 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,
+ 'voucher_type': frm.doc.doctype,
+ }
+ };
+ }
frm.add_fetch("bom_no", "inspection_required", "inspection_required");
erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype);
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
index 6afbf01..0664c29 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -42,6 +42,17 @@
}
});
+ let sbb_field = 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,
+ 'warehouse': row.doc.warehouse,
+ 'voucher_type': frm.doc.doctype,
+ }
+ };
+ }
+
if (frm.doc.company) {
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
index bd1512b..5ee1f7b 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
@@ -89,6 +89,16 @@
}
});
+ let sbb_field = frm.get_docfield('supplied_items', 'serial_and_batch_bundle');
+ if (sbb_field) {
+ sbb_field.get_route_options_for_new_doc = (row) => {
+ return {
+ 'item_code': row.doc.rm_item_code,
+ 'voucher_type': frm.doc.doctype,
+ }
+ };
+ }
+
let batch_no_field = frm.get_docfield('items', 'batch_no');
if (batch_no_field) {
batch_no_field.get_route_options_for_new_doc = function(row) {