Merge pull request #18774 from deepeshgarg007/test_case_fix

fix: Failing sales and purchase return test cases
This commit is contained in:
Mangesh-Khairnar 2019-08-19 19:20:52 +05:30 committed by GitHub
commit 09ddc84c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,9 @@ 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:
party_type = "customer" if doc.doctype in ("Sales Invoice", "Delivery Note") else "supplier"
if ref_doc.company == doc.company and ref_doc.get(party_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")