From 78d5ccf5fc4ed38abf642a7949e8cc8c18635e5a Mon Sep 17 00:00:00 2001 From: vwithv1602 Date: Mon, 4 Dec 2017 11:16:34 +0530 Subject: [PATCH] Invalid return against purchase invoice Error - Issue#11834 (#11835) --- erpnext/controllers/sales_and_purchase_return.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index d609b9e02b..d16f063c20 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -20,9 +20,9 @@ def validate_return_against(doc): frappe.throw(_("{0} is mandatory for Return").format(doc.meta.get_label("return_against"))) else: filters = {"doctype": doc.doctype, "docstatus": 1, "company": doc.company} - if doc.meta.get_field("customer"): + if doc.meta.get_field("customer") and doc.customer: filters["customer"] = doc.customer - elif doc.meta.get_field("supplier"): + elif doc.meta.get_field("supplier") and doc.supplier: filters["supplier"] = doc.supplier if not frappe.db.exists(filters):