refactor(supplier_scorecard):replace sql with orm (#55161)

This commit is contained in:
Loic Oberle
2026-05-22 12:41:04 +02:00
committed by GitHub
parent 30ba93fb8f
commit f5899b5519

View File

@@ -89,19 +89,11 @@ class SupplierScorecard(Document):
throw(_("Criteria weights must add up to 100%")) throw(_("Criteria weights must add up to 100%"))
def calculate_total_score(self): def calculate_total_score(self):
scorecards = frappe.db.sql( scorecards = frappe.get_all(
""" "Supplier Scorecard Period",
SELECT fields=["name"],
scp.name filters={"scorecard": self.name, "docstatus": 1},
FROM order_by="end_date desc",
`tabSupplier Scorecard Period` scp
WHERE
scp.scorecard = %(sc)s
AND scp.docstatus = 1
ORDER BY
scp.end_date DESC""",
{"sc": self.name},
as_dict=1,
) )
period = 0 period = 0