Skip to content

Commit

Permalink
fix: item not set in the batch quick entry form (#44028)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitwaghchaure authored Nov 8, 2024
1 parent dfe233f commit 0399ccc
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,28 +289,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
}
]);
}

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() {
Expand Down Expand Up @@ -409,6 +387,35 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
this.setup_quality_inspection();
this.validate_has_items();
erpnext.utils.view_serial_batch_nos(this.frm);
this.set_route_options_for_new_doc();
}

set_route_options_for_new_doc() {
// While creating the batch from the link field, copy item from line item to batch form

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
}
};
}
}

// While creating the SABB from the link field, copy item, doctype from line item to SABB form
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,
"voucher_type": this.frm.doc.doctype,
}
};
}
}
}

scan_barcode() {
Expand Down

0 comments on commit 0399ccc

Please sign in to comment.