diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py index 8ff32a47ec6..bca1c74e380 100644 --- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py +++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py @@ -89,19 +89,11 @@ class SupplierScorecard(Document): throw(_("Criteria weights must add up to 100%")) def calculate_total_score(self): - scorecards = frappe.db.sql( - """ - SELECT - scp.name - FROM - `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, + scorecards = frappe.get_all( + "Supplier Scorecard Period", + fields=["name"], + filters={"scorecard": self.name, "docstatus": 1}, + order_by="end_date desc", ) period = 0