From 5bf77beb83245b49f9287d8ce88d8cdad5e18cfa Mon Sep 17 00:00:00 2001 From: Zarrar Date: Mon, 29 Jan 2018 16:47:52 +0530 Subject: [PATCH] precision while checking qty (#12688) --- erpnext/stock/doctype/batch/batch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 760643c4ecd..8c8b986ec7d 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -115,8 +115,8 @@ def set_batch_nos(doc, warehouse_field, throw = False): d.batch_no = get_batch_no(d.item_code, warehouse, qty, throw) else: batch_qty = get_batch_qty(batch_no=d.batch_no, warehouse=warehouse) - if flt(batch_qty) < flt(qty): - frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, d.qty)) + if flt(batch_qty, d.precision("stock_qty")) < flt(qty, d.precision("stock_qty")): + frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, d.stock_qty)) @frappe.whitelist() def get_batch_no(item_code, warehouse, qty=1, throw=False):