[IMP] sale_timesheet: get SOL of task if customer different

Before this commit, when the partner_id is set in project and the
partner_id in the task is different, if the user changes the SOL in the
task, the SOL of each timesheets keeps the SOL defined in the employee
mapping.

This commit gives the SOL of the task if the partner_id of the task is
different than the one in the project.

task-2442683

closes odoo/odoo#66181
This commit is contained in:
Xavier BOL (xbo)
2021-04-16 10:35:47 +02:00
committed by Yannick Tivisse
parent f228ac33bd
commit 7704103875
+1 -1
View File
@@ -92,7 +92,7 @@ class AccountAnalyticLine(models.Model):
if self.project_id.sale_line_id:
return self.project_id.sale_line_id
if self.task_id.allow_billable and self.task_id.sale_line_id:
if self.task_id.pricing_type in ('task_rate', 'fixed_rate'):
if self.task_id.pricing_type in ('task_rate', 'fixed_rate') or self.task_id.partner_id != self.project_id.partner_id:
return self.task_id.sale_line_id
else: # then pricing_type = 'employee_rate'
map_entry = self.project_id.sale_line_employee_ids.filtered(lambda map_entry: map_entry.employee_id == self.employee_id)