fix: Usability fixes to Serial No and batch selector (#18071)
* fix: Usability fixes to Serial No and batch selector * fix: Codacy * Update sales_common.js
This commit is contained in:
@@ -44,6 +44,13 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
label: __(me.warehouse_details.type),
|
||||
default: me.warehouse_details.name,
|
||||
onchange: function(e) {
|
||||
|
||||
if(me.has_batch) {
|
||||
fields = fields.concat(me.get_batch_fields());
|
||||
} else {
|
||||
fields = fields.concat(me.get_serial_no_fields());
|
||||
}
|
||||
|
||||
me.warehouse_details.name = this.get_value();
|
||||
var batches = this.layout.fields_dict.batches;
|
||||
if(batches) {
|
||||
@@ -263,6 +270,15 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
|
||||
get_batch_fields: function() {
|
||||
var me = this;
|
||||
|
||||
let filters = {
|
||||
item_code: me.item_code
|
||||
}
|
||||
|
||||
if (me.warehouse || me.warehouse_details.name) {
|
||||
filters['warehouse'] = me.warehouse || me.warehouse_details.name;
|
||||
}
|
||||
|
||||
return [
|
||||
{fieldtype:'Section Break', label: __('Batches')},
|
||||
{fieldname: 'batches', fieldtype: 'Table', label: __('Batch Entries'),
|
||||
@@ -276,8 +292,8 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
'in_list_view': 1,
|
||||
get_query: function () {
|
||||
return {
|
||||
filters: { item: me.item_code },
|
||||
query: 'erpnext.controllers.queries.get_batch_numbers'
|
||||
filters: filters,
|
||||
query: 'erpnext.controllers.queries.get_batch_no'
|
||||
};
|
||||
},
|
||||
change: function () {
|
||||
|
||||
Reference in New Issue
Block a user