mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
refactor(supplier): use frappe orm for database queries (#54842)
replace raw SQL with frappe orm to leverage the framework's native capabilities. this improves code maintainability and adheres to frappe best practices.
This commit is contained in:
@@ -181,20 +181,15 @@ def daterange(start_date, end_date):
|
|||||||
|
|
||||||
|
|
||||||
def refresh_scorecards():
|
def refresh_scorecards():
|
||||||
scorecards = frappe.db.sql(
|
"""
|
||||||
"""
|
Refresh the scorecards
|
||||||
SELECT
|
"""
|
||||||
sc.name
|
scorecards = frappe.get_list("Supplier Scorecard", fields=["name"], pluck="name", limit_page_length=0)
|
||||||
FROM
|
for sc_name in scorecards:
|
||||||
`tabSupplier Scorecard` sc""",
|
|
||||||
{},
|
|
||||||
as_dict=1,
|
|
||||||
)
|
|
||||||
for sc in scorecards:
|
|
||||||
# Check to see if any new scorecard periods are created
|
# Check to see if any new scorecard periods are created
|
||||||
if make_all_scorecards(sc.name) > 0:
|
if make_all_scorecards(sc_name) > 0:
|
||||||
# Save the scorecard to update the score and standings
|
# Save the scorecard to update the score and standings
|
||||||
frappe.get_doc("Supplier Scorecard", sc.name).save()
|
frappe.get_doc("Supplier Scorecard", sc_name).save()
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
Reference in New Issue
Block a user