fix(ux): set route options for new SBB

This commit is contained in:
s-aga-r 2023-06-16 15:04:37 +05:30
parent 50f83859db
commit 4b5454c752
10 changed files with 103 additions and 0 deletions

View File

@ -112,6 +112,17 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s
}
};
});
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() {

View File

@ -40,6 +40,16 @@ frappe.ui.form.on('Asset Repair', {
}
}
});
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) {

View File

@ -23,6 +23,17 @@ frappe.ui.form.on('Job Card', {
}
});
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") {

View File

@ -134,6 +134,15 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
}
}
});
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(

View File

@ -18,6 +18,16 @@ frappe.ui.form.on('Installation Note', {
}
}
});
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) {

View File

@ -46,6 +46,17 @@ frappe.ui.form.on('Quotation', {
}
}
});
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) {

View File

@ -65,6 +65,17 @@ frappe.ui.form.on('Pick List', {
}
}
});
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)) {

View File

@ -115,6 +115,15 @@ frappe.ui.form.on('Stock Entry', {
}
});
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);

View File

@ -42,6 +42,17 @@ frappe.ui.form.on("Stock Reconciliation", {
}
});
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);

View File

@ -89,6 +89,16 @@ frappe.ui.form.on('Subcontracting Receipt', {
}
});
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) {