fix: incorrect available_qty being set (#22539)
* fix: incorrect available_qty being set
* style: descriptive variables
diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js
index 42f9cabc..d9f6e1d 100644
--- a/erpnext/public/js/utils/serial_no_batch_selector.js
+++ b/erpnext/public/js/utils/serial_no_batch_selector.js
@@ -338,8 +338,8 @@
};
},
change: function () {
- let val = this.get_value();
- if (val.length === 0) {
+ const batch_no = this.get_value();
+ if (!batch_no) {
this.grid_row.on_grid_fields_dict
.available_qty.set_value(0);
return;
@@ -359,14 +359,11 @@
return;
}
- let batch_number = me.item.batch_no ||
- this.grid_row.on_grid_fields_dict.batch_no.get_value();
-
if (me.warehouse_details.name) {
frappe.call({
method: 'erpnext.stock.doctype.batch.batch.get_batch_qty',
args: {
- batch_no: batch_number,
+ batch_no,
warehouse: me.warehouse_details.name,
item_code: me.item_code
},