mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-28 09:24:45 +00:00
refactor(sales_order): replace SQL with ORM in check_nextdoc_docstatus (#55204)
This commit is contained in:
@@ -577,13 +577,12 @@ class SalesOrder(SellingController):
|
|||||||
check_credit_limit(self.customer, self.company)
|
check_credit_limit(self.customer, self.company)
|
||||||
|
|
||||||
def check_nextdoc_docstatus(self):
|
def check_nextdoc_docstatus(self):
|
||||||
linked_invoices = frappe.db.sql_list(
|
linked_invoices = frappe.get_all(
|
||||||
"""select distinct t1.name
|
"Sales Invoice Item",
|
||||||
from `tabSales Invoice` t1,`tabSales Invoice Item` t2
|
filters={"sales_order": self.name, "docstatus": 0},
|
||||||
where t1.name = t2.parent and t2.sales_order = %s and t1.docstatus = 0""",
|
pluck="parent",
|
||||||
self.name,
|
distinct=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
if linked_invoices:
|
if linked_invoices:
|
||||||
linked_invoices = [get_link_to_form("Sales Invoice", si) for si in linked_invoices]
|
linked_invoices = [get_link_to_form("Sales Invoice", si) for si in linked_invoices]
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
|
|||||||
Reference in New Issue
Block a user