From 73854972198e99ba529651211ad264e9c50ea5ab Mon Sep 17 00:00:00 2001 From: Subin Tom Date: Mon, 3 Jan 2022 16:57:00 +0530 Subject: [PATCH] fix: using get_batch_qty method to get available_qty --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 4 ++-- erpnext/stock/doctype/batch/batch.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 6cda6266e4..11d59bcf70 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -15,7 +15,7 @@ from erpnext.accounts.doctype.sales_invoice.sales_invoice import ( update_multi_mode_option, ) from erpnext.accounts.party import get_due_date, get_party_account -from erpnext.stock.doctype.batch.batch import get_pos_reserved_batch_qty +from erpnext.stock.doctype.batch.batch import get_batch_qty, get_pos_reserved_batch_qty from erpnext.stock.doctype.serial_no.serial_no import get_pos_reserved_serial_nos, get_serial_nos @@ -131,7 +131,7 @@ class POSInvoice(SalesInvoice): def validate_pos_reserved_batch_qty(self, item): filters = {"item_code": item.item_code, "warehouse": item.warehouse, "batch_no":item.batch_no} - available_batch_qty = frappe.db.get_value('Batch', item.batch_no, 'batch_qty') + available_batch_qty = get_batch_qty(item.batch_no, item.warehouse, item.item_code) reserved_batch_qty = get_pos_reserved_batch_qty(filters) bold_item_name = frappe.bold(item.item_name) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 77e53c569d..5593101575 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -335,4 +335,5 @@ def get_pos_reserved_batch_qty(filters): (item.batch_no == filters.get('batch_no')) ).run() - return reserved_batch_qty[0][0] \ No newline at end of file + flt_reserved_batch_qty = flt(reserved_batch_qty[0][0]) + return flt_reserved_batch_qty \ No newline at end of file