From 48474a2d4e15e4489e4af68f5d9117675d3981ef Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Tue, 2 Jul 2019 10:11:02 +0530 Subject: [PATCH] fix: Fiter passing fix in get batch query (#18130) --- erpnext/controllers/queries.py | 1 - erpnext/public/js/utils/serial_no_batch_selector.js | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index a40f0eff43b..e7f8c27d6df 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -297,7 +297,6 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters): order by batch.expiry_date, sle.batch_no desc limit %(start)s, %(page_len)s""".format(cond, match_conditions=get_match_cond(doctype)), args) - if batch_nos: return batch_nos else: return frappe.db.sql("""select name, concat('MFG-', manufacturing_date), concat('EXP-',expiry_date) from `tabBatch` batch diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index 576ae0fbde1..c6086b9962b 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -240,14 +240,6 @@ 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') }, { @@ -262,7 +254,10 @@ erpnext.SerialNoBatchSelector = Class.extend({ 'in_list_view': 1, get_query: function () { return { - filters: filters, + filters: { + item_code: me.item_code, + warehouse: me.warehouse || me.warehouse_details.name + }, query: 'erpnext.controllers.queries.get_batch_no' }; },