跳至內容
選單
此問題已被標幟
1 回覆
8157 瀏覽次數

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)

頭像
捨棄
最佳答案

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.

頭像
捨棄
作者

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

相關帖文 回覆 瀏覽次數 活動
0
9月 23
92
5
4月 25
15889
3
11月 20
11754
1
6月 19
5822
1
8月 18
4875