fix: Available qty not shown in item batch selector for batch

This commit is contained in:
deepeshgarg007 2019-06-10 17:33:36 +05:30
parent dde4f93137
commit 30f7e7be87

View File

@ -268,18 +268,19 @@ erpnext.SerialNoBatchSelector = Class.extend({
{fieldname: 'batches', fieldtype: 'Table', label: __('Batch Entries'), {fieldname: 'batches', fieldtype: 'Table', label: __('Batch Entries'),
fields: [ fields: [
{ {
fieldtype:'Link', 'fieldtype': 'Link',
fieldname:'batch_no', 'read_only': 0,
options: 'Batch', 'fieldname': 'batch_no',
label: __('Select Batch'), 'options': 'Batch',
in_list_view:1, 'label': __('Select Batch'),
'in_list_view': 1,
get_query: function () { get_query: function () {
return { return {
filters: { item: me.item_code }, filters: { item: me.item_code },
query: 'erpnext.controllers.queries.get_batch_numbers' query: 'erpnext.controllers.queries.get_batch_numbers'
}; };
}, },
onchange: function(e) { change: function (e) {
let val = this.get_value(); let val = this.get_value();
if (val.length === 0) { if (val.length === 0) {
this.grid_row.on_grid_fields_dict this.grid_row.on_grid_fields_dict
@ -323,23 +324,24 @@ erpnext.SerialNoBatchSelector = Class.extend({
} }
}, },
{ {
fieldtype:'Float', 'fieldtype': 'Float',
read_only:1, 'read_only': 1,
fieldname:'available_qty', 'fieldname': 'available_qty',
label: __('Available'), 'label': __('Available'),
in_list_view:1, 'in_list_view': 1,
default: 0, 'default': 0,
onchange: function() { change: function () {
this.grid_row.on_grid_fields_dict.selected_qty.set_value('0'); this.grid_row.on_grid_fields_dict.selected_qty.set_value('0');
} }
}, },
{ {
fieldtype:'Float', 'fieldtype': 'Float',
fieldname:'selected_qty', 'read_only': 0,
label: __('Qty'), 'fieldname': 'selected_qty',
in_list_view:1, 'label': __('Qty'),
'in_list_view': 1,
'default': 0, 'default': 0,
onchange: function(e) { change: function (e) {
var batch_no = this.grid_row.on_grid_fields_dict.batch_no.get_value(); var batch_no = this.grid_row.on_grid_fields_dict.batch_no.get_value();
var available_qty = this.grid_row.on_grid_fields_dict.available_qty.get_value(); var available_qty = this.grid_row.on_grid_fields_dict.available_qty.get_value();
var selected_qty = this.grid_row.on_grid_fields_dict.selected_qty.get_value(); var selected_qty = this.grid_row.on_grid_fields_dict.selected_qty.get_value();