refactor(sales_order): Replace SQL with ORM in make_maintenance_schedule (#55206)

This commit is contained in:
Loic Oberle
2026-05-23 08:27:27 +02:00
committed by GitHub
parent 6f9f6d3b7d
commit 983ae011f0

View File

@@ -1599,11 +1599,8 @@ def make_sales_invoice(
@frappe.whitelist()
def make_maintenance_schedule(source_name: str, target_doc: str | Document | None = None):
maint_schedule = frappe.db.sql(
"""select t1.name
from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2
where t2.parent=t1.name and t2.sales_order=%s and t1.docstatus=1""",
source_name,
maint_schedule = frappe.db.exists(
"Maintenance Schedule Item", {"sales_order": source_name, "docstatus": 1}
)
if not maint_schedule: