mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-16 18:24:10 +00:00
refactor(postgres): port payment_setup_certification query to the query builder
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import frappe
|
import frappe
|
||||||
|
from frappe.query_builder.functions import IfNull
|
||||||
|
|
||||||
no_cache = 1
|
no_cache = 1
|
||||||
|
|
||||||
@@ -12,13 +13,15 @@ def get_context(context):
|
|||||||
def get_all_certifications_of_a_member():
|
def get_all_certifications_of_a_member():
|
||||||
"""Returns all certifications"""
|
"""Returns all certifications"""
|
||||||
all_certifications = []
|
all_certifications = []
|
||||||
all_certifications = frappe.db.sql(
|
cc = frappe.qb.DocType("Certified Consultant")
|
||||||
""" select cc.name,cc.from_date,cc.to_date,ca.amount,ca.currency
|
ca = frappe.qb.DocType("Certification Application")
|
||||||
from `tabCertified Consultant` cc
|
all_certifications = (
|
||||||
inner join `tabCertification Application` ca
|
frappe.qb.from_(cc)
|
||||||
on cc.certification_application = ca.name
|
.inner_join(ca)
|
||||||
where paid = 1 and email = %(user)s order by cc.to_date desc""",
|
.on(cc.certification_application == ca.name)
|
||||||
{"user": frappe.session.user},
|
.select(cc.name, cc.from_date, cc.to_date, ca.amount, ca.currency)
|
||||||
as_dict=True,
|
.where((cc.paid == 1) & (cc.email == frappe.session.user))
|
||||||
|
.orderby(IfNull(cc.to_date, "0001-01-01"), order=frappe.qb.desc)
|
||||||
|
.run(as_dict=True)
|
||||||
)
|
)
|
||||||
return all_certifications
|
return all_certifications
|
||||||
|
|||||||
Reference in New Issue
Block a user