Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
8131 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ย. 23
92
5
เม.ย. 25
15867
3
พ.ย. 20
11734
1
มิ.ย. 19
5813
1
ส.ค. 18
4867