Skip to content

Commit

Permalink
[MIG] project_parent_task_filter: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadforgeflow committed Dec 14, 2021
1 parent 79252d3 commit 2457ef0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions project_parent_task_filter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
2 changes: 1 addition & 1 deletion project_parent_task_filter/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Project Parent Task Filter",
"summary": "Add a filter to show the parent tasks",
"version": "14.0.1.1.0",
"version": "15.0.1.0.0",
"category": "Project",
"website": "https://github.com/OCA/project",
"author": "C2i Change 2 improve, " "Odoo Community Association (OCA)",
Expand Down
1 change: 1 addition & 0 deletions project_parent_task_filter/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import project
26 changes: 26 additions & 0 deletions project_parent_task_filter/models/project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

from odoo import models,api

class TaskSub(models.Model):
_inherit = "project.task"

@api.model_create_multi
def create(self,vals_list):
res=super(TaskSub, self).create(vals_list)
for vals in vals_list:
if vals.get('parent_id',False):
res['display_project_id']=self.env["project.task"].browse(
vals.get('parent_id')
).project_id.id
return res

def action_subtask(self):
action = {"type": "ir.actions.act_window",
"name": "Subtasks of " + self.name,
"res_model": "project.task",
"view_mode": "tree,kanban",
"search_view_id": [self.env.ref('project.view_task_search_form').id, 'search'],
'domain': [('id', '!=', self.id), ('id', 'child_of', self.id)]}
return action


0 comments on commit 2457ef0

Please sign in to comment.