← Back to team overview

openerp-expert-framework team mailing list archive

Re: How to initialize one2many widget in wizard

 

I finally changed one2many for many2many widget, and it works perfect. i think 
that one2many should be as simple as that.

thanks anyway.


class cruce_perfiles_wizard(osv.osv_memory):
    
    def _perfiles(self,cr,uid,context):
       perfiles_dict = 
self.pool.get('qlc.cliente').read(cr,uid,context['cliente'],['perfiles'])
       return perfiles_dict['perfiles']

    _name = 'qlc.cliente.cruce_perfiles.wizard'

    _columns = {
	'perfiles': 
fields.many2many('qlc.perfil.cliente','dummy','dummy','dummy','Perfiles'), # 
hacemos esto para poder generar el control en el formulario

    }
    
    _defaults = {
        'perfiles': _perfiles,    # OO insiste en llamar a la funcion con 4 
parametros

    }


--------------


On Friday 21 January 2011 04:49:10 Er. Jay Vora wrote:
> Hi Felipe,
>
> You may always ask questions on launchpad too.
> For your problem, you can get hints from addons/account/installer.py
> where _get_default_accounts can help you.
>
> Thanks.
>
> On Thursday 20 January 2011 11:26 PM, Felipe Alvarez wrote:
> > Hi,
> >
> > i got  this code:
> >
> > class cruce_perfiles_wizard(osv.osv_memory):
> >      def _perfiles(self,cr,uid,context):
> >         perfiles_dict =
> > self.pool.get('qlc.cliente').read(cr,uid,context['cliente'],['perfiles'])
> >         #return perfiles_dict['perfiles']
> > <----------------------
> >         return {'perfiles': perfiles_dict['perfiles']}
> > <---------------------
> >      _name = 'qlc.cliente.cruce_perfiles.wizard'
> >
> >      _columns = {
> >          'perfiles': fields.one2many('qlc.perfil.cliente','dummy',
> > 'Perfiles'), # hacemos esto para poder generar el control en el
> > formulario
> >
> >      }
> >      _defaults = {
> >          'perfiles': _perfiles,    # OO insiste en llamar a la funcion
> > con 4 parametros
> >
> >      }
> >
> >
> > cruce_perfiles_wizard()
> >
> >
> > The thing is i don't know how to return correct values from _perfiles.
> > Neither way i've done works, it even doesn't show the view.
> >
> > Thanks.



-- 
Felipe Alvarez Harnecker

felipe@xxxxx
http://ql.cl/