From 9af79fd60cef00ad77368b58b0739cccbca4270e Mon Sep 17 00:00:00 2001 From: Marica Date: Thu, 16 Sep 2021 15:47:17 +0530 Subject: [PATCH] fix: Validate if item exists on uploading items in stock reco (#27538) * fix: Validate if item exists on uploading items in stock reco - Uploading non existent item in stock reco and then changing warehouse or batch gave an error - Check for non existent item * chore: translation Co-authored-by: Ankush Menat (cherry picked from commit 9b388883d39d278ecc20ae3d99ee25a752714caa) --- .../doctype/stock_reconciliation/stock_reconciliation.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 0248cdfbcf0..824478154bd 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -726,6 +726,11 @@ def get_stock_balance_for( item_dict = frappe.db.get_value("Item", item_code, ["has_serial_no", "has_batch_no"], as_dict=1) + if not item_dict: + # In cases of data upload to Items table + msg = _("Item {} does not exist.").format(item_code) + frappe.throw(msg, title=_("Missing")) + if not item_dict: # In cases of data upload to Items table msg = _("Item {} does not exist.").format(item_code)