Invalid return against purchase invoice Error - Issue#11834 (#11835)

diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py
index d609b9e..d16f063 100644
--- a/erpnext/controllers/sales_and_purchase_return.py
+++ b/erpnext/controllers/sales_and_purchase_return.py
@@ -20,9 +20,9 @@
 		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):