Merge pull request #16749 from Alchez/hotfix-cancelled-payments

fix(payments): Only check for Draft or Submitted payments while cancelling payment requests
This commit is contained in:
Rushabh Mehta
2019-03-22 12:43:52 +05:30
committed by GitHub

View File

@@ -214,9 +214,10 @@ class PaymentRequest(Document):
def check_if_payment_entry_exists(self):
if self.status == "Paid":
payment_entry = frappe.db.sql_list("""select parent from `tabPayment Entry Reference`
where reference_name=%s""", self.reference_name)
if payment_entry:
if frappe.get_all("Payment Entry Reference",
filters={"reference_name": self.reference_name, "docstatus": ["<", 2]},
fields=["parent"],
limit=1):
frappe.throw(_("Payment Entry already exists"), title=_('Error'))
def make_communication_entry(self):