Skip to Content
मेन्यू
This question has been flagged
1 Reply
8234 Views

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
Discard

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
Discard
Related Posts Replies Views Activity
1
फ़र॰ 18
4312
1
जन॰ 17
3648
2
मई 21
7329
5
अप्रैल 19
8856
3
मई 16
6120