From b0b88e9cb11ccb5cbf968e259a25973ed61a1bf1 Mon Sep 17 00:00:00 2001 From: "Laurent Stukkens (LTU)" Date: Tue, 29 Jun 2021 16:39:31 +0000 Subject: [PATCH] [FIX] sale_timesheet: correctly compute remaining_hours_so Steps to reproduce: - Install sale_timesheet with demo data - Add a UOM 200h with the following characteristics: - Category: Working Time - Type: Bigger than the reference Unit of Measure - Bigger Ratio: 25 - Create a new product with the following characteristics: - Product Type: Service - Service Invoicing Policy: Prepaid - Unit of Measure: 200h - Create a Quotation SO1 with the following characteristics: - Customer: Deco Addict - a SOL with product 200h and quantity 1 - Confirm the Quotation SO1 - Create a new project P1 with the following characteristics: - Timesheets: True - Billable: True - Edit the project and set the customer to Deco Addict - Create a new task T1 with the following characteristics: - Project: P1 - Sales Order Item: SOL of SO1 with product 200h - Timesheet in the task Current behavior: - When timesheeting, the quantity of Remaining Hours on SO is decreased by 200 * nb of hours in timesheet(s). Expected behavior: - When timesheeting, the quantity of Remaining Hours on SO is decreased by the number of hours in the timesheet(s). This behavior was introduced in commit b0f165bbd8041b5a01fb09122da76ba14cfa3e94 closes odoo/odoo#72988 X-original-commit: d7c0821094246d84a233b4feddd3b0174f130119 Signed-off-by: Yannick Tivisse (yti) Signed-off-by: LTU-Odoo --- addons/sale_timesheet/models/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index 9940fed70bd..cb0d8c6411e 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -367,7 +367,7 @@ class ProjectTask(models.Model): if timesheet.so_line == timesheet.task_id.sale_line_id: delta -= timesheet.unit_amount if delta: - mapped_remaining_hours[timesheet.task_id._origin.id] += timesheet.so_line.product_uom._compute_quantity(delta, uom_hour) + mapped_remaining_hours[timesheet.task_id._origin.id] += timesheet.product_uom_id._compute_quantity(delta, uom_hour) for task in self: task.remaining_hours_so = mapped_remaining_hours[task._origin.id]