Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
133 Lượt xem

Hello,


I've added a new field in the project.task class to calculate subtasks, and I've added a function to open a new task kanban filtered only by subtasks, but the problem is that when I add the filtered kanban, I lost click action to kanban and cannot open the task itself.


I think that the problem is because I'm not passing the specific action of task kanban. Example:


This is the url  when I open a specific project to see their tasks in the kanban, and are referencing action=183

web#action=183&active_id=2&model=project.task&view_type=kanban&cids=1&menu_id=112


And this is the same url filtering the same task kanban but with subtask id, but the problem is that I'm not referencing the task kanban action id, so I lost the click in the filtered kanban and cannot open filtered subtasks.

web#active_id=11&model=project.task&view_type=kanban&cids=1&menu_id=112


This is the function to open the filtered kanban, but I don't know who to add the action of task kanban. Maybe view_id?


def action_open_task_kanban(self, task_ids):

         return {

            'type': 'ir.actions.act_window',

            'name': 'Subtareas Filtradas',

            'res_model': 'project.task',

            'view_mode': 'kanban',

            'target': 'current',

            'domain': [('id', 'in', task_ids)],

        }


Thanks


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,


Try the following code.


def action_open_task_kanban(self, task_ids):

    action = self.env.ref('project.action_view_task').read()[0]

    action.update({

        'name': 'Subtareas Filtradas',

        'domain': [('id', 'in', task_ids)],

    })

    return action



Hope it helps

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Great, it works.

Thank you very much

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 15
6166
1
thg 1 25
1854
0
thg 4 24
1449
2
thg 3 23
6868
0
thg 1 23
1827