mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
Merge pull request #55375 from loicdokos/refactor/sales_invoice-get_mode_of_payment_info
refactor(sales_invoice): replace sql with qb in get_mode_of_payment_info
This commit is contained in:
@@ -3182,14 +3182,22 @@ def get_mode_of_payments_info(mode_of_payments, company):
|
|||||||
|
|
||||||
|
|
||||||
def get_mode_of_payment_info(mode_of_payment, company):
|
def get_mode_of_payment_info(mode_of_payment, company):
|
||||||
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 = %s and mp.enabled = 1 and mp.name = %s""",
|
frappe.qb.from_(ModeOfPayment)
|
||||||
(company, mode_of_payment),
|
.join(ModeOfPaymentAccount)
|
||||||
as_dict=1,
|
.on(ModeOfPaymentAccount.parent == ModeOfPayment.name)
|
||||||
|
.select(
|
||||||
|
ModeOfPaymentAccount.default_account, ModeOfPaymentAccount.parent, ModeOfPayment.type.as_("type")
|
||||||
)
|
)
|
||||||
|
.where(ModeOfPaymentAccount.company == company)
|
||||||
|
.where(ModeOfPayment.enabled == 1)
|
||||||
|
.where(ModeOfPayment.name == mode_of_payment)
|
||||||
|
)
|
||||||
|
|
||||||
|
return query.run(as_dict=1)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
Reference in New Issue
Block a user