Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
8231 Tampilan

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
Buang

Can you paste whole code here ??

Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Feb 18
4308
1
Jan 17
3647
2
Mei 21
7329
5
Apr 19
8851
3
Mei 16
6119