How to redirect a view when clicking a button...
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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...
But 1 problem,, When clicking the button i got a new window,, But there is no save button in that window... Can u help..
use 'target':'current'
Thanks a lot my dear...
Where are u from?
Pondicherry..India
Hw r u
come to my personal email...vsnthajay@gmail.com