On Thu, Jan 14, 2010 at 07:57:28PM +0100, Cédric Krier wrote:
> On 14/01/10 11:50 -0500, Juan Fernando Jaramillo Botero wrote:
> > Hello, someone know how to add a item to one context of a record of a model
> > that have a field Many2One in such a way that it could be read from the
> > records that belong to the first record?
> >
> > I have something like this:
> >
> > class OrdenDeTrabajo(ModelWorkflow, ModelSQL, ModelView):
> > 'Ordenes de Trabajo'
> > _name = 'taller.ordendetrabajo'
> > _description = __doc__
> > _order_name="id"
> > descriptions =
> > fields.One2Many('taller.description','ordendetrabajo','Descripciones',
> > states=STATES)
> > ...
> >
> > class Description(ModelSQL, ModelView):
> > 'descripciones de una orden'
> > _name = 'taller.description'
> > _description = __doc__
> > #_rec_name="id"
> > _order_name="id"
> >
> > ordendetrabajo = fields.Many2One('taller.ordendetrabajo','Orden de
> > Trabajo',required=True, select=1, states=STATES)
> >
> > I was try to add the parameter: context = "{'tipo_pintura':'BC'}", first in
> > the field descriptions, and them in the field ordendetrabajo, but doesn't
> > work.
> >
> > Some idea?
>
> If I have well understand, it should work:
>
> ordendetrabajo = fields.Many2One('taller.ordendetrabajo','Orden de
> Trabajo',required=True, select=1, states=STATES,
> context={'tipo_pintura':'BC'})
>
Well, actually it was I try, but it doesn't add the item 'tipo_pintura' to the
context.The point to be more concret, is how can I add new variables to the context? Regards -- Juan Fernando Jaramillo Gte Tecnología MIG Internacional www.miginternacional.com
signature.asc
Description: Digital signature
