From ba8c0412063a6c930d255b5cb5b993d676c353f8 Mon Sep 17 00:00:00 2001 From: "shreyashah115@gmail.com" Date: Thu, 20 Dec 2018 13:23:51 +0530 Subject: [PATCH] fix: Check if items exist --- erpnext/buying/doctype/purchase_order/purchase_order.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index d4f1de1776..e0781f137a 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -85,6 +85,7 @@ class PurchaseOrder(BuyingController): frappe.msgprint(_("{0} currently has a {1} Supplier Scorecard standing, and Purchase Orders to this supplier should be issued with caution.").format(self.supplier, standing), title=_("Caution"), indicator='orange') def validate_minimum_order_qty(self): + if not self.get("items"): return items = list(set([d.item_code for d in self.get("items")])) itemwise_min_order_qty = frappe._dict(frappe.db.sql("""select name, min_order_qty