fix: Display draft invoices only once in error message

This commit is contained in:
GangaManoj 2021-10-02 02:15:17 +05:30
parent 99edc9c83a
commit 6e5a3c0ea4

View File

@ -249,7 +249,7 @@ class SalesOrder(SellingController):
frappe.throw(_("Sales Invoice {0} must be cancelled before cancelling this Sales Order")
.format(", ".join(submit_rv)))
draft_rv = frappe.db.sql_list("""select t1.name
draft_rv = frappe.db.sql_list("""select distinct t1.name
from `tabSales Invoice` t1,`tabSales Invoice Item` t2
where t1.name = t2.parent and t2.sales_order = %s and t1.docstatus = 0""",
self.name)