İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
9032 Görünümler

How can i redirect to other model form view on "Create" button click. I tries that using "view_init", and try to return model name etc, but it didn't work. I tried that code 


def view_init(self, cr, uid, fields_list, context=None):
return {
'name': _('Patient Group Lab Test Form'),
'view_mode': 'form',
'view_id': False,
'view_type': 'form',
'res_model': 'oeh.group.lab.test',
'type': 'ir.actions.act_window',
'target': 'self',
}

Currently i am on that model "oeh.medical.radiology.report", and i need to open "oeh.group.lab.test" form view on create button click.

Come on odoo developers plz help me, am badly stuck in it


Avatar
Vazgeç
En İyi Yanıt

ahmed,

What you can do is,

in create method only, call its super and then return this :

return {  
     'name': _('Patient Group Lab Test Form'),
    'view_mode': 'form',
    'view_id': False,
    'view_type': 'form', 
   'res_model': 'oeh.group.lab.test',
    'type': 'ir.actions.act_window',
    'target': 'self',
}

But before returning this, you have to commit the changes you have done, as odoo expects new record id from create method as a return statement, but we are going to return an action....

So use : cr.commit() before returning above lines....

Hope this Help you....

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Eyl 23
1700
0
Eyl 23
1428
2
Haz 25
10760
6
Eki 23
21549
3
Mar 24
9077