[FIX] project: filter when not required

Before this commit:

A method action_subtask is including the other actions context if have which
reflects while clicking on the Sub-tasks stat button. For examples:

- When click on the stat button 'Sub-tasks' of any task which one is clicked by
  systray activity icon results
- When click on the task menu in project there a default search filter 'My task'
  which also passes when click on 'sub tasks' stat button

After this commit:

Remove the context that startswith `search_default'.
Hence, now subtask will display with the correct context.

Task-2413127

closes odoo/odoo#66401

X-original-commit: b13fc817d150f642254c4738cfbd91ac2ecaa65f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
bit-odoo
2021-02-17 16:51:41 +00:00
parent 72917b4a82
commit c2d20902f6
+1
View File
@@ -1377,6 +1377,7 @@ class Task(models.Model):
else:
default_project = self.project_id.subtask_project_id or self.project_id
ctx = dict(self.env.context)
ctx = {k: v for k, v in ctx.items() if not k.startswith('search_default_')}
ctx.update({
'default_name': self.env.context.get('name', self.name) + ':',
'default_parent_id': self.id, # will give default subtask field in `default_get`