From 2f71b740fd59ece329c039dbcf3e846c228329b3 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 23 Aug 2021 14:27:55 +0530 Subject: [PATCH] fix: selected batch no changed on updation of qty --- erpnext/selling/sales_common.js | 4 ++++ erpnext/stock/get_item_details.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 04285735abd..26ac630a32b 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -390,6 +390,10 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }, _set_batch_number: function(doc) { + if (doc.batch_no) { + return + } + let args = {'item_code': doc.item_code, 'warehouse': doc.warehouse, 'qty': flt(doc.qty) * flt(doc.conversion_factor)}; if (doc.has_serial_no && doc.serial_no) { args['serial_no'] = doc.serial_no diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index a0fbcecc5de..c72073c6143 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -278,6 +278,10 @@ def get_basic_details(args, item, overwrite_warehouse=True): else: args.uom = item.stock_uom + if (args.get("batch_no") and + item.name != frappe.get_cached_value('Batch', args.get("batch_no"), 'item')): + args['batch_no'] = '' + out = frappe._dict({ "item_code": item.name, "item_name": item.item_name,