[FIX] sale_project: fix usage of unavailable field "is_fsm"

Step to reproduce:
1. Install module "sale_project"
2. In Project > Configuration > Settings, turn on "Recurring Tasks"
3. Create a recurrent task
4. Set the "next_recurrence_date" for the recurrence ahead of today
5. Run scheduled action " Project: Create Recurring Tasks"
=> error: 'project.task' object has no attribute 'is_fsm'

Reason:
"is_fsm" is defined in the module "industry_fsm" and the module "sale_project" does not depend on that module.

opw-2412370

closes odoo/odoo#63325

X-original-commit: 36c3fb0e1d16f5cce21e3edcb01ee8a39a35caa8
Related: odoo/enterprise#15288
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Qiuyu (QHO)
2020-12-14 12:19:44 +00:00
committed by Anh Thao Pham (pta)
parent abea29fcd2
commit 8bfaedef29
+4 -2
View File
@@ -139,6 +139,8 @@ class ProjectTaskRecurrence(models.Model):
def _new_task_values(self, task):
values = super(ProjectTaskRecurrence, self)._new_task_values(task)
task = self.sudo().task_ids[0]
if not task.is_fsm:
values['sale_line_id'] = task.sale_line_id.id
values['sale_line_id'] = self._get_sale_line_id(task)
return values
def _get_sale_line_id(self, task):
return task.sale_line_id.id