mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 19:24:21 +00:00
fix: use query builder instead of raw SQL in get_timesheet_detail_rate
(cherry picked from commit e563ed0c75)
This commit is contained in:
@@ -292,12 +292,16 @@ def get_projectwise_timesheet_data(project=None, parent=None, from_time=None, to
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_timesheet_detail_rate(timelog, currency):
|
def get_timesheet_detail_rate(timelog, currency):
|
||||||
timelog_detail = frappe.db.sql(
|
ts = frappe.qb.DocType("Timesheet")
|
||||||
f"""SELECT tsd.billing_amount as billing_amount,
|
ts_detail = frappe.qb.DocType("Timesheet Detail")
|
||||||
ts.currency as currency FROM `tabTimesheet Detail` tsd
|
|
||||||
INNER JOIN `tabTimesheet` ts ON ts.name=tsd.parent
|
timelog_detail = (
|
||||||
WHERE tsd.name = '{timelog}'""",
|
frappe.qb.from_(ts_detail)
|
||||||
as_dict=1,
|
.inner_join(ts)
|
||||||
|
.on(ts.name == ts_detail.parent)
|
||||||
|
.select(ts_detail.billing_amount.as_("billing_amount"), ts.currency.as_("currency"))
|
||||||
|
.where(ts_detail.name == timelog)
|
||||||
|
.run(as_dict=1)
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
if timelog_detail.currency:
|
if timelog_detail.currency:
|
||||||
|
|||||||
Reference in New Issue
Block a user