[IMP] sale_timesheet: let the SOL when project changed to employee rate

Before this commit, when the user changes the project on the task to
choose a project with the pricing type to employee rate, then the SOL on
this task is removed.

This commit removes this behaviour to let the SOL of the task.

task-2376382

closes odoo/odoo#66157
This commit is contained in:
Xavier BOL (xbo)
2021-03-17 14:57:33 +01:00
parent 00ce1211f9
commit ab9eea0759
-9
View File
@@ -262,15 +262,6 @@ class ProjectTask(models.Model):
if not self.sale_line_id:
self.sale_line_id = self.project_id.sale_line_id
def write(self, values):
res = super(ProjectTask, self).write(values)
# Done after super to avoid constraints on field recomputation
if values.get('project_id'):
project_dest = self.env['project.project'].browse(values['project_id'])
if project_dest.pricing_type == 'employee_rate':
self.write({'sale_line_id': False})
return res
def _get_last_sol_of_customer(self):
# Get the last SOL made for the customer in the current task where we need to compute
self.ensure_one()