Se rendre au contenu
Menu
Cette question a été signalée
3 Réponses
9285 Vues

How can I switch to another view after I click a new created button?:

<button name="start_work" attrs="{'invisible':[('work_time_status','!=', True)]}" string="Stop Work" type="object" class="oe_highlight"/>

In the python code in the function start_work.


Avatar
Ignorer
Auteur Meilleure réponse

I found a solution:

return {

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

'res_model': 'project.task.work',

'view_type': 'form',

'view_mode': 'tree,form',

}

Avatar
Ignorer
Meilleure réponse

This is a way to switch a other view after clicking button

<button name="start_work" attrs="{'invisible':[('work_time_status','!=', True)]}" string="Stop Work" type="object" class="oe_highlight"/>

@api.multi

def start_work(self):

course_form = self.env.ref('your form view name', False)

return {

'name': 'New Course',

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

'res_model': 'your module name',

'view_type': 'form',

'view_mode': 'tree,form',

'target': 'self',

'views': [(course_form.id, 'form')],

'view_id': 'course_form.id',

'flags': {'action_buttons': True},

        }

Avatar
Ignorer
Auteur

this is not working, I need an example on the task view

Publications associées Réponses Vues Activité
2
déc. 23
18231
1
juil. 17
4220
11
sept. 21
31916
1
déc. 18
5522
2
nov. 18
7851