From ea4783be014021f27e9c0c7989dfe162fe81d469 Mon Sep 17 00:00:00 2001 From: jbm-odoo Date: Mon, 6 Jan 2020 13:36:40 +0000 Subject: [PATCH] [FIX] sale_timesheet: Uom for stat button of sale When UOM of timsheet is in days, the amount is not correct in the stat button of sale. closes odoo/odoo#42764 Taskid: 2160680 Signed-off-by: Yannick Tivisse (yti) --- addons/sale_timesheet/models/sale_order.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/addons/sale_timesheet/models/sale_order.py b/addons/sale_timesheet/models/sale_order.py index 30707fd6486..fad76f7a94d 100644 --- a/addons/sale_timesheet/models/sale_order.py +++ b/addons/sale_timesheet/models/sale_order.py @@ -31,15 +31,8 @@ class SaleOrder(models.Model): @api.depends('timesheet_ids', 'company_id.timesheet_encode_uom_id') def _compute_timesheet_total_duration(self): for sale_order in self: - duration_list = [] timesheets = sale_order.timesheet_ids if self.user_has_groups('hr_timesheet.group_hr_timesheet_approver') else sale_order.timesheet_ids.filtered(lambda t: t.user_id.id == self.env.uid) - for timesheet in timesheets: - timesheet_uom = timesheet.product_uom_id or timesheet.company_id.project_time_mode_id - if timesheet_uom != sale_order.timesheet_encode_uom_id and timesheet_uom.category_id == sale_order.timesheet_encode_uom_id.category_id: - duration_list.append(timesheet_uom._compute_quantity(timesheet.unit_amount, sale_order.timesheet_encode_uom_id)) - else: - duration_list.append(timesheet.unit_amount) - sale_order.timesheet_total_duration = sum(duration_list) + sale_order.timesheet_total_duration = sum([timesheet.unit_amount for timesheet in timesheets]) def action_view_project_ids(self): self.ensure_one()