Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
8308 Vizualizări

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? 

Imagine profil
Abandonează

Can you paste whole code here ??

Cel mai bun răspuns

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',     }
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
feb. 18
4407
1
ian. 17
3697
2
mai 21
7383
5
apr. 19
8923
3
mai 16
6191