Se rendre au contenu
Menu
Cette question a été signalée

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'     

                      }

Avatar
Ignorer

I faced the same issue

Meilleure réponse

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

Avatar
Ignorer
Auteur

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

Publications associées Réponses Vues Activité
3
juin 21
12500
4
juin 16
4917
2
avr. 16
12913
1
oct. 16
9815
2
mars 16
2938