From 3dbf51babe0e8933a72f1b2fd9af9a615b55cdd2 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 13 Feb 2019 11:05:48 +0000 Subject: [PATCH] [FIX] sale_timesheet: cost with different UOM - Create a Service article: UoM = Day(s) Invoicing policy = on ordered quantity Tracking = Task in project - Create a SO: 10 days, unit price = $100 and validate. - On the task created, the initially planned hours is equal to 80 (10 * 8h). - On this task, timesheet some hours with several employees: 15 hours 10 hours 10 hours The `timesheet_revenue` on analytic lines is incorrect: 1000 0 0 It should be: 187.5 125 125 The unit conversion between days and hours is not performed... opw-1925320 closes odoo/odoo#31062 --- addons/sale_timesheet/models/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_timesheet/models/account.py b/addons/sale_timesheet/models/account.py index d1181785557..8a5fbdcaad4 100644 --- a/addons/sale_timesheet/models/account.py +++ b/addons/sale_timesheet/models/account.py @@ -134,7 +134,7 @@ class AccountAnalyticLine(models.Model): total_revenue_invoiced = sum(analytic_lines.mapped('timesheet_revenue')) # compute (new) revenue of current timesheet line values['timesheet_revenue'] = min( - analytic_account.currency_id.round(unit_amount * so_line.currency_id.compute(so_line.price_unit, analytic_account.currency_id) * (1-so_line.discount)), + analytic_account.currency_id.round(unit_amount * sale_price * (1-so_line.discount/100)), total_revenue_so - total_revenue_invoiced ) values['timesheet_invoice_type'] = 'billable_fixed'