mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
refactor(sales_invoice): replace sql with qb in get_all_mode_of_payments (#55377)
This commit is contained in:
@@ -3142,14 +3142,21 @@ def update_multi_mode_option(doc, pos_profile):
|
|||||||
|
|
||||||
|
|
||||||
def get_all_mode_of_payments(doc):
|
def get_all_mode_of_payments(doc):
|
||||||
return frappe.db.sql(
|
ModeOfPaymentAccount = frappe.qb.DocType("Mode of Payment Account")
|
||||||
"""
|
ModeOfPayment = frappe.qb.DocType("Mode of Payment")
|
||||||
select mpa.default_account, mpa.parent, mp.type as type
|
|
||||||
from `tabMode of Payment Account` mpa,`tabMode of Payment` mp
|
query = (
|
||||||
where mpa.parent = mp.name and mpa.company = %(company)s and mp.enabled = 1""",
|
frappe.qb.from_(ModeOfPaymentAccount)
|
||||||
{"company": doc.company},
|
.join(ModeOfPayment)
|
||||||
as_dict=1,
|
.on(ModeOfPaymentAccount.parent == ModeOfPayment.name)
|
||||||
|
.select(
|
||||||
|
ModeOfPaymentAccount.default_account, ModeOfPaymentAccount.parent, ModeOfPayment.type.as_("type")
|
||||||
)
|
)
|
||||||
|
.where(ModeOfPaymentAccount.company == doc.company)
|
||||||
|
.where(ModeOfPayment.enabled == 1)
|
||||||
|
)
|
||||||
|
|
||||||
|
return query.run(as_dict=1)
|
||||||
|
|
||||||
|
|
||||||
def get_mode_of_payments_info(mode_of_payments, company):
|
def get_mode_of_payments_info(mode_of_payments, company):
|
||||||
|
|||||||
Reference in New Issue
Block a user