It is currently Sun Feb 12, 2012 10:27 am

All times are UTC + 2 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: osv_memory wizard multi pages
PostPosted: Sun Mar 14, 2010 10:51 pm 
Offline

Joined: Sun Aug 17, 2008 7:39 pm
Posts: 71
Location: France - Jura
I try to make an osv_memory with several page on the same object.
The goal is to fill the entire page step by step, because some choices call some intermediate search.
I do it with old wizard and it works, but i need now to use onchange on some page and so i need to use osv_memory.

No problem to arrive on the first page.
When i try to go to the second page, i can't choose the view_id.

i try in my action function :
pages = self.pool.get('ir.ui.view').search(cr,uid,'name','=','view.name.p1')])
result = {
'view_type' : 'form',
'view_mode' : 'form',
'view_id' : '%s' % (pages and pages[0] or False),
'res_model' : 'pm_base.wizard.new_partner',
'type' : 'ir.actions.act_window',
'target' : 'new',
'context' : context,
}
return result

when printing result data , i have :
result : {'target': 'new', 'view_type': 'form', 'res_model': 'pm_base.wizard.new_partner', 'view_id': '537', 'view_mode': 'form', 'context': {'lang': u'fr_FR', 'new_part_id': 1, 'active_ids': [486], 'tz': u'Europe/Paris', 'active_id': 486}, 'type': 'ir.actions.act_window'}

view_id is the good number, but it's allways the same pages which is show, and it is not the one i draw.

i try with integer value for view_id, but in this case first page is closed and nothing happens (and nothing in logs : client and server)

Is someone use osv_memory wizard with several screens and can help me on how call second page and continue to work on memory object.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2010 5:37 pm 
Offline

Joined: Sun Aug 17, 2008 7:39 pm
Posts: 71
Location: France - Jura
i progress.
I know know how to access previous value.
But i always don't know how to change the view i want.

If someone know, thanks by advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2010 5:50 pm 
Offline

Joined: Sun Aug 17, 2008 7:39 pm
Posts: 71
Location: France - Jura
i found. View_id is define with two values.
inspired from wizard number, my method two switch pages on same class :
Code:
    def go_page1(self, cr, uid, ids, context=None):
        new_part_id = self.read(cr, uid, ids, [])[0]
        context.update({'new_part_id' : new_part_id['id']})
        cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('view.new_partnenaire.wizard.p1', 'form'))
        view_res = cr.fetchone()
        result = {
            'view_type'      : 'form',
            'view_mode'      : 'form',
            'view_id'      : view_res,
            'res_model'      : 'pm_base.wizard.new_partner',
            'type'         : 'ir.actions.act_window',
            'target'      : 'new',
            'context'      : context,
        }
        return result

    def go_page2(self, cr, uid, ids, context=None):
        new_part_id = self.read(cr, uid, ids, [])[0]
        context.update({'new_part_id' : new_part_id['id']})
        cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('view.new_partnenaire.wizard.p2', 'form'))
        view_res = cr.fetchone()
        result = {
            'view_type'      : 'form',
            'view_mode'      : 'form',
            'view_id'      : view_res,
            'res_model'      : 'pm_base.wizard.new_partner',
            'type'         : 'ir.actions.act_window',
            'target'      : 'new',
            'context'      : context,
        }
        return result


perhaps more simple, but for the moment, it works.
A lack in the documentation...... (another)


Top
 Profile  
 
 Post subject: Re: osv_memory wizard multi pages
PostPosted: Mon Oct 03, 2011 4:18 pm 
Offline

Joined: Fri Aug 19, 2011 2:12 pm
Posts: 22
Could anyone commnet on this? i'd be very interested to see the right approach....


Top
 Profile  
 
 Post subject: Re: osv_memory wizard multi pages
PostPosted: Thu Oct 27, 2011 6:45 am 
Offline

Joined: Fri Apr 08, 2011 6:16 am
Posts: 7
view_res = self.pool.get('ir.ui.view').search(cr, uid, [('name','=','view.name'),('model','=','model.name')])

result = {
'view_type' : 'form',
'view_mode' : 'form',
'view_id' : view_res,
'res_model' : 'pm_base.wizard.new_partner',
'type' : 'ir.actions.act_window',
'target' : 'new',
'context' : context,
}
return result

it works for me.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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