[FIX] sale_timesheet: correct timesheet_revenues calculation

This fix corrects the measure 'timesheet_revenues' calculation
in the Timesheet report.
It is now billable_time * aal.sol.price_unit.

task-3007122

closes odoo/odoo#103513

X-original-commit: 3729c024a4a76b453d21d56805b7f5d4390cf9f3
Related: odoo/enterprise#32937
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Signed-off-by: Audric Onockx (auon) <auon@odoo.com>
This commit is contained in:
Audric Onockx (auon)
2022-10-20 10:19:52 +02:00
parent 70a80d4cd1
commit 7501bf3b8e
@@ -36,6 +36,11 @@ class TimesheetsAnalysisReport(models.Model):
A.so_line AS so_line,
A.timesheet_invoice_type AS timesheet_invoice_type,
A.timesheet_invoice_id AS timesheet_invoice_id,
(-1 * A.unit_amount * A.amount) AS timesheet_revenues,
CASE WHEN order_id IS NULL THEN 0 ELSE unit_amount END AS billable_time
CASE WHEN A.order_id IS NULL THEN 0 ELSE A.unit_amount * SOL.price_unit END AS timesheet_revenues,
CASE WHEN A.order_id IS NULL THEN 0 ELSE A.unit_amount END AS billable_time
"""
@api.model
def _from(self):
return super()._from() + """
LEFT JOIN sale_order_line SOL ON A.so_line = SOL.id"""