From 59a3012a5ce3b9e0229ed54d64f421da9cf60df7 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 15 Mar 2019 08:57:49 +0530 Subject: [PATCH] Update payment_request.py --- .../accounts/doctype/payment_request/payment_request.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 1fbde753d41..64c4124da66 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -214,11 +214,10 @@ class PaymentRequest(Document): def check_if_payment_entry_exists(self): if self.status == "Paid": - payment_entry = frappe.get_all("Payment Entry Reference", + if frappe.get_all("Payment Entry Reference", filters={"reference_name": self.reference_name, "docstatus": ["<", 2]}, - fields=["distinct(parent)"]) - - if any(payment_entry): + fields=["parent"], + limit=1): frappe.throw(_("Payment Entry already exists"), title=_('Error')) def make_communication_entry(self):