Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to switch to a other view after clicking a button

By
wizardz
on 7/20/16, 5:04 AM 279 views

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.


-1
wizardz
On 7/25/16, 8:19 AM

I found a solution:

return {

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

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

'view_type': 'form',

'view_mode': 'tree,form',

}

0
kirubanidhi
On 7/20/16, 6:16 AM

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},

        }

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

wizardz
on 7/22/16, 4:40 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/20/16, 5:04 AM
Seen: 279 times
Last updated: 7/26/16, 8:49 AM