Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Return a wizard

By
Celia
on 5/23/16, 3:43 AM 326 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? 

Can you paste whole code here ??

Ankit H Gandhi(AHG)
on 5/24/16, 4:16 AM
0
Michał Węgrzynek
On 5/23/16, 12:08 PM

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',     }

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/23/16, 3:43 AM
Seen: 326 times
Last updated: 5/23/16, 12:08 PM