It is currently Mon May 21, 2012 7:23 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Solved] Call wizard from a method
PostPosted: Wed Jul 20, 2011 12:03 pm 
Offline

Joined: Thu Mar 31, 2011 8:45 am
Posts: 241
Location: Málaga, Spain
Hi, i want to know if a wizard can be invoked inside of a method, i.e, when a user press the save button on form, i do some checks and i want to invoke an osv_memory wizard in some determined conditions.

I found this code in the forums, but it doesn't works

Code:
def action_call_wizard(self,cr,uid,ids,context=None):
        if context is None: context = {}
        wizard_id = self.pool.get("your.osv.memory.wizard").create(
            cr, uid, {}, context=dict(context, active_ids=ids))
        return {
            'name':_("name of wizard"),
            'view_mode': 'form',
            'view_id': False,
            'view_type': 'form',
            'res_model': 'your.osv.memory.wizard',
            'res_id':wizard_id,
            'type': 'ir.actions.act_window',
            'nodestroy': True,
            'target': 'new',
            'domain': '[]',
            'context': dict(context, active_ids=ids)
        }

_________________
Desarrollo Compuservice
Parque Tecnológico de Andalucía


Last edited by Reinhart on Thu Jul 21, 2011 10:08 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Call wizard from a method
PostPosted: Thu Jul 21, 2011 5:18 am 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
It can be done.

The logic is quite straightforward.

You have a button.
It calls a function.
Function does some processing.
As a result function returns True or the Wizard.

Easy.

Partial Shipping in stock is the best example I can think of.

_________________
Graeme


Top
 Profile  
 
 Post subject: Re: Call wizard from a method
PostPosted: Thu Jul 21, 2011 10:07 am 
Offline

Joined: Thu Mar 31, 2011 8:45 am
Posts: 241
Location: Málaga, Spain
Thanks for your answer, i found that i need to 'return action_call_wizard' to make the above code work, if i only call the function the wizard doesn't appear.

_________________
Desarrollo Compuservice
Parque Tecnológico de Andalucía


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP