Skip to Content
Menú
This question has been flagged
1 Respondre
8202 Vistes

I have a function where I want to return a wizard, I use this:

def display_error_message(self, cr, uid, error, context=None):    
    return {        
        'name': _("Error"),        
        'context': {'error': error},        
        'view_type': 'form',        
        'view_mode': 'form',        
        'res_model': 'close.wizard',        
        'views': [(False, 'form')],        
        'type': 'ir.actions.act_window',        
        'target': 'new',    
    }

I see it in a lot of answers but, for me, doesn't work
Any idea? 

Avatar
Descartar

Can you paste whole code here ??

Best Answer

I'm guessing your wizard is named 'close.wizard' and it doesn't have any required fields without default values.

In that case, try the following code:

def display_error_message(self, cr, uid, error, context=None):  
clw_id = self.pool.get('close.wizard').create(cr, uid, {}, context=context)   
 
return {         'name': _("Error"),         'context': {'error': error},         'view_type': 'form',         'view_mode': 'form',         'res_model': 'close.wizard',
       'res_id': clw_id,
'views': [(False, 'form')],         'type': 'ir.actions.act_window',         'target': 'new',     }
Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de febr. 18
4284
1
de gen. 17
3610
2
de maig 21
7308
5
d’abr. 19
8824
3
de maig 16
6105