From c80e5fe7a1e7d39eb297ba73c3e1c3ebf6845be1 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 19 Aug 2019 14:38:15 +0530 Subject: [PATCH] fix: Failing sales and purchase return test cases --- erpnext/controllers/sales_and_purchase_return.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index 28dd4ea8b6f..6a03c519ef9 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -24,7 +24,12 @@ def validate_return_against(doc): else: ref_doc = frappe.get_doc(doc.doctype, doc.return_against) - if ref_doc.company == doc.company and ref_doc.customer == doc.customer and ref_doc.docstatus == 1: + if doc.doctype == "Sales Invoice": + party_type == "customer" + else: + party_type == "supplier" + + if ref_doc.company == doc.company and ref_doc.get(pary_type) == doc.get(party_type) and ref_doc.docstatus == 1: # validate posting date time return_posting_datetime = "%s %s" % (doc.posting_date, doc.get("posting_time") or "00:00:00") ref_posting_datetime = "%s %s" % (ref_doc.posting_date, ref_doc.get("posting_time") or "00:00:00")