mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
fix: Display message to delete linked invoices in the draft state
This commit is contained in:
@@ -241,7 +241,7 @@ class SalesOrder(SellingController):
|
|||||||
# Checks Sales Invoice
|
# Checks Sales Invoice
|
||||||
submit_rv = frappe.db.sql_list("""select t1.name
|
submit_rv = frappe.db.sql_list("""select t1.name
|
||||||
from `tabSales Invoice` t1,`tabSales Invoice Item` t2
|
from `tabSales Invoice` t1,`tabSales Invoice Item` t2
|
||||||
where t1.name = t2.parent and t2.sales_order = %s and t1.docstatus < 2""",
|
where t1.name = t2.parent and t2.sales_order = %s and t1.docstatus = 1""",
|
||||||
self.name)
|
self.name)
|
||||||
|
|
||||||
if submit_rv:
|
if submit_rv:
|
||||||
@@ -249,6 +249,16 @@ class SalesOrder(SellingController):
|
|||||||
frappe.throw(_("Sales Invoice {0} must be cancelled before cancelling this Sales Order")
|
frappe.throw(_("Sales Invoice {0} must be cancelled before cancelling this Sales Order")
|
||||||
.format(", ".join(submit_rv)))
|
.format(", ".join(submit_rv)))
|
||||||
|
|
||||||
|
draft_rv = frappe.db.sql_list("""select 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)
|
||||||
|
|
||||||
|
if draft_rv:
|
||||||
|
draft_rv = [get_link_to_form("Sales Invoice", si) for si in draft_rv]
|
||||||
|
frappe.throw(_("Sales Invoice {0} must be deleted before cancelling this Sales Order")
|
||||||
|
.format(", ".join(draft_rv)))
|
||||||
|
|
||||||
#check maintenance schedule
|
#check maintenance schedule
|
||||||
submit_ms = frappe.db.sql_list("""
|
submit_ms = frappe.db.sql_list("""
|
||||||
select t1.name
|
select t1.name
|
||||||
|
|||||||
Reference in New Issue
Block a user