fix: [v12] incorrect available_qty being set (#22541)

* fix: incorrect available_qty being set

* style: descriptive variables
This commit is contained in:
Sun Howwrongbum
2020-07-23 20:06:15 +05:30
committed by GitHub
parent d18eb0e63e
commit 4e3df334db

View File

@@ -333,8 +333,8 @@ erpnext.SerialNoBatchSelector = Class.extend({
}; };
}, },
change: function () { change: function () {
let val = this.get_value(); const batch_no = this.get_value();
if (val.length === 0) { if (!batch_no) {
this.grid_row.on_grid_fields_dict this.grid_row.on_grid_fields_dict
.available_qty.set_value(0); .available_qty.set_value(0);
return; return;
@@ -354,14 +354,11 @@ erpnext.SerialNoBatchSelector = Class.extend({
return; return;
} }
let batch_number = me.item.batch_no ||
this.grid_row.on_grid_fields_dict.batch_no.get_value();
if (me.warehouse_details.name) { if (me.warehouse_details.name) {
frappe.call({ frappe.call({
method: 'erpnext.stock.doctype.batch.batch.get_batch_qty', method: 'erpnext.stock.doctype.batch.batch.get_batch_qty',
args: { args: {
batch_no: batch_number, batch_no,
warehouse: me.warehouse_details.name, warehouse: me.warehouse_details.name,
item_code: me.item_code item_code: me.item_code
}, },