Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
7914 Näkymät

Is it possible to override save button and redirect to a new view after saving the record? Or is there another solution?

something like this:

    @api.model

    def create(self, vals):

        return{

           'name': ('new view'),

           'view_type': 'kanban',

           'view_mode': 'kanban',

           'res_model': 'model.test',

           'view_id': False,

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

           'target': 'current',

         }

        return super(CourseSeries, self).create(vals)

Avatar
Hylkää
Paras vastaus

second return will not be reachable here and you will get an error. so you should override write() method instead of create, where create() should return an id and write() should return a boolean value. There is also save() function available, so do according to your logic.

Avatar
Hylkää
Tekijä

Thanks, but I still cannot open a view after create or write method

just read the answer carefully, create() returns a record or recordset and write() returns Bool values. so they cant return any action or nothing

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
syysk. 23
92
5
huhtik. 25
15351
3
marrask. 20
11262
1
kesäk. 19
5577
1
elok. 18
4587