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.

1

Redirect a View

By
aci aisha
on 1/23/15, 5:30 AM 731 views

How to redirect a view when clicking a button...

1

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 1/23/15, 7:35 AM

Hi aci aisha,

You can use 2 ways of redirect a view from the button click.

1.       return {

                     'name' : 'Module name',

                      'view_type' : 'form',

                      'view_mode' : 'form',

                       'view_id': False,

                        'res_model' : 'res.partner',

                        'context' : context,

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

                         'target' : 'current',

                     }

(or) 

2.       mod_obj = self.pool.get('ir.model.data')

           res = mod_obj.get_object_reference(cr, uid, 'res_partner', 'res_partner_form_view')

          res_id = res and res[1] or False

          return{ 

                    'name':'Module name',

                     'res_model':'res.partner',

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

                      'view_type': 'form',

                      'view_mode': 'form',

                       'view_id': [res_id],

                      'context':{},

                     'target':'new'

                       }

In xml_view:

<button name="method name"  type="object" />

Put that code in the return of the method.Hope it works..All the best

Thanks a lot Vasanth...

aci aisha
on 1/28/15, 12:38 AM

But 1 problem,, When clicking the button i got a new window,, But there is no save button in that window... Can u help..

aci aisha
on 1/28/15, 12:59 AM

use 'target':'current'

Vasanth
on 1/28/15, 1:01 AM

Thanks a lot my dear...

aci aisha
on 1/28/15, 1:04 AM

Where are u from?

aci aisha
on 1/28/15, 1:04 AM

Pondicherry..India

Vasanth
on 1/28/15, 1:05 AM

Hw r u

aci aisha
on 1/28/15, 1:06 AM

come to my personal email...vsnthajay@gmail.com

Vasanth
on 1/28/15, 1:08 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: 1/23/15, 5:30 AM
Seen: 731 times
Last updated: 3/16/15, 8:10 AM