From 64f48db406e33a2edc0b2f24e7a29abfb0a1615b Mon Sep 17 00:00:00 2001 From: Sachin Mane Date: Mon, 8 Jan 2018 17:57:32 +0530 Subject: [PATCH] Batch number selector bug fix (#12346) * fix bug in batch number selector. fetch and display batch numbers only for the given item code. * remove print statement * Fix error on selecting Chattisgarh in address Fix error on selecting Chattisgarh in address because of spelling mistake * Revert "Fix error on selecting Chattisgarh in address" --- erpnext/controllers/queries.py | 4 ++-- erpnext/public/js/utils/serial_no_batch_selector.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index a71a08e7fc..dd95026869 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -418,6 +418,6 @@ def get_batch_numbers(doctype, txt, searchfield, start, page_len, filters): 'where (`tabBatch`.expiry_date >= CURDATE() or `tabBatch`.expiry_date IS NULL)' if filters and filters.get('item_code'): - query += 'where item = %(item_code)s' % filters + query += 'and item = %(item_code)s' - return frappe.db.sql(query) + return frappe.db.sql(query, filters) diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index e21caadcfe..a974b9997e 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -215,7 +215,7 @@ erpnext.SerialNoBatchSelector = Class.extend({ in_list_view:1, get_query: function() { return { - filters: {item: me.item_code }, + filters: {item_code: me.item_code }, query: 'erpnext.controllers.queries.get_batch_numbers' }; }, @@ -357,4 +357,4 @@ erpnext.SerialNoBatchSelector = Class.extend({ } ]; } -}); \ No newline at end of file +});