From 740d2f26171fa80bfbdf83bac248684e147c98df Mon Sep 17 00:00:00 2001 From: MaxLarue Date: Tue, 10 Sep 2019 12:18:05 +0000 Subject: [PATCH] [FIX] industry_fsm: fix sale order issue when adding product without timesheet on tasks The link between a sale_order and a task relied on a sale_line between the sale order and the tasks. This was working when allow timesheet and allow material were true, as we had a timesheet_product_id and the sale_line was created empty. But when we create a project with material but no timesheet, the sale line would crash. Now the sale order and the sale line creation are split, and we write the sale order id on the tasks. This works because with the new ORM, we can write on a stored compute field, and if we take care of not overwriting it in the compute, it stays at what we wrote. task-2047389 closes-5388 --- addons/sale_timesheet/models/project.py | 2 +- addons/sale_timesheet/views/project_task_views.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index 0135390789d..d611d47fbeb 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -147,7 +147,7 @@ class ProjectTask(models.Model): help="Sales order item to which the task is linked. If an employee timesheets on a this task, " "and if this employee is not in the 'Employee/Sales Order Item Mapping' of the project, the " "timesheet entry will be linked to this sales order item.", copy=False) - sale_order_id = fields.Many2one('sale.order', 'Sales Order', compute='_compute_sale_order_id', compute_sudo=True, store=True, readonly=True, help="Sales order to which the task is linked.") + sale_order_id = fields.Many2one('sale.order', 'Sales Order', compute='_compute_sale_order_id', store=True, readonly=False, help="Sales order to which the task is linked.") billable_type = fields.Selection([ ('task_rate', 'At Task Rate'), ('employee_rate', 'At Employee Rate'), diff --git a/addons/sale_timesheet/views/project_task_views.xml b/addons/sale_timesheet/views/project_task_views.xml index eae595102b3..7beb53bfbdb 100644 --- a/addons/sale_timesheet/views/project_task_views.xml +++ b/addons/sale_timesheet/views/project_task_views.xml @@ -50,8 +50,9 @@ - + +