From 7c088ff6233a651b868a57cbfa44c917e5ddd70f Mon Sep 17 00:00:00 2001 From: Zarrar Date: Tue, 5 Jun 2018 10:32:09 +0530 Subject: [PATCH] dont validate items if item_code not found (#14344) item_code field is not set when created using invoice creation tool --- erpnext/controllers/buying_controller.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 3536233fc85..b0d1e348b98 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -467,7 +467,12 @@ class BuyingController(StockController): def validate_item_type(doc, fieldname, message): # iterate through items and check if they are valid sales or purchase items - items = [d.item_code for d in doc.items] + items = [d.item_code for d in doc.items if d.item_code] + + # No validation check inase of creating transaction using 'Opening Invoice Creation Tool' + if not items: + return + item_list = ", ".join(["'%s'" % frappe.db.escape(d) for d in items]) invalid_items = [d[0] for d in frappe.db.sql("""