From 7501bf3b8e2d6636198d5b9488807a4a2fa57fc8 Mon Sep 17 00:00:00 2001 From: "Audric Onockx (auon)" Date: Mon, 10 Oct 2022 10:48:05 +0000 Subject: [PATCH] [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) Signed-off-by: Audric Onockx (auon) --- .../sale_timesheet/report/timesheets_analysis_report.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/sale_timesheet/report/timesheets_analysis_report.py b/addons/sale_timesheet/report/timesheets_analysis_report.py index 549ace946fb..24cddec584b 100644 --- a/addons/sale_timesheet/report/timesheets_analysis_report.py +++ b/addons/sale_timesheet/report/timesheets_analysis_report.py @@ -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"""