Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
118 Widoki

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


Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Great, it works.

Thank you very much

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
gru 15
6163
1
sty 25
1851
0
kwi 24
1447
2
mar 23
6866
0
sty 23
1827