fix: batch selector flag (#31191)

This is broken again after serializing scan actions, which causes
selector to trigger before batch_no is set.

Solution: for duration of scan disable the selector
This commit is contained in:
Ankush Menat 2022-05-31 14:14:27 +05:30 committed by GitHub
parent a8f98f3f96
commit ddb46c5711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -526,12 +526,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
if(!d[k]) d[k] = v;
});
if (d.__disable_batch_serial_selector) {
// reset for future use.
d.__disable_batch_serial_selector = false;
return;
}
if (d.has_batch_no && d.has_serial_no) {
d.batch_no = undefined;
}

View File

@ -98,6 +98,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner {
() => this.set_batch_no(row, batch_no),
() => this.set_barcode(row, barcode),
() => this.clean_up(),
() => this.revert_selector_flag(row, data),
() => resolve(row)
]);
});
@ -112,10 +113,14 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner {
const require_selecting_serial = has_serial_no && !serial_no;
if (!(require_selecting_batch || require_selecting_serial)) {
row.__disable_batch_serial_selector = true;
frappe.flags.hide_serial_batch_dialog = true;
}
}
revert_selector_flag() {
frappe.flags.hide_serial_batch_dialog = false;
}
set_item(row, item_code) {
return new Promise(resolve => {
const increment = async (value = 1) => {