fix(ux): filters for SCR Item Serial and Batch Bundle (#37013)

This commit is contained in:
s-aga-r 2023-09-10 17:10:04 +05:30 committed by GitHub
parent 846ae32d92
commit ce549ce9b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,6 +145,14 @@ frappe.ui.form.on('Subcontracting Receipt', {
}
});
frm.set_query('serial_and_batch_bundle', 'items', (doc, cdt, cdn) => {
return frm.events.get_serial_and_batch_bundle_filters(doc, cdt, cdn);
});
frm.set_query('rejected_serial_and_batch_bundle', 'items', (doc, cdt, cdn) => {
return frm.events.get_serial_and_batch_bundle_filters(doc, cdt, cdn);
});
frm.set_query('batch_no', 'supplied_items', (doc, cdt, cdn) => {
var row = locals[cdt][cdn];
return {
@ -166,16 +174,6 @@ 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 = (row) => {
@ -184,6 +182,48 @@ frappe.ui.form.on('Subcontracting Receipt', {
}
}
}
let item_sbb_field = frm.get_docfield('items', 'serial_and_batch_bundle');
if (item_sbb_field) {
item_sbb_field.get_route_options_for_new_doc = (row) => {
return {
'item_code': row.doc.item_code,
'voucher_type': frm.doc.doctype,
}
}
}
let rejected_item_sbb_field = frm.get_docfield('items', 'rejected_serial_and_batch_bundle');
if (rejected_item_sbb_field) {
rejected_item_sbb_field.get_route_options_for_new_doc = (row) => {
return {
'item_code': row.doc.item_code,
'voucher_type': frm.doc.doctype,
}
}
}
let rm_sbb_field = frm.get_docfield('supplied_items', 'serial_and_batch_bundle');
if (rm_sbb_field) {
rm_sbb_field.get_route_options_for_new_doc = (row) => {
return {
'item_code': row.doc.rm_item_code,
'voucher_type': frm.doc.doctype,
}
}
}
},
get_serial_and_batch_bundle_filters: (doc, cdt, cdn) => {
let row = locals[cdt][cdn];
return {
filters: {
'item_code': row.item_code,
'voucher_type': doc.doctype,
'voucher_no': ['in', [doc.name, '']],
'is_cancelled': 0,
}
}
},
setup_quality_inspection: (frm) => {