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

Hello,

I want to return a view from a onchange function ,but not able to redirect ..

Here is my code

@api.multi

@api.onchange('product_id')

def product_id_change(self):
        model_obj = self.env['ir.model.data']    

    [ if not self.product_id:
        return {'domain': {'product_uom': []}}        vals = {}  
        domain = {'product_uom': [('category_id', '=', self.product_id.uom_id.category_id.id)]}............]

         data_id = model_obj._get_id('hotelbeds', 'view_search_hotel')   

         view_ids = model_obj.browse(data_id).res_id

        return {       

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

                        'name': _('Hotel Search'),   

                        'domain': domain,     

                        'view_id' :view_ids,     

                       'view_type': 'form',   

                       'view_mode': 'form',      

                      'res_model': 'hotel.search',  

                      'target': 'new'     

                      }

อวตาร
ละทิ้ง

I faced the same issue

คำตอบที่ดีที่สุด

HI Naresh, I Haven't tested yet to return act window,
But as far as I know onchange can only return value, warning or domain.

Regards

อวตาร
ละทิ้ง
ผู้เขียน

Yes,onchange function is not expected to return anything instead it is only used to alter in-memory changes.

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
มิ.ย. 21
12660
4
มิ.ย. 16
5020
2
เม.ย. 16
13028
1
ต.ค. 16
9916
2
มี.ค. 16
3043