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


PS: tryton-dev is a better place for this kind of question.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: [email protected]
Jabber: [email protected]
Website: http://www.b2ck.com/
twitter: http://twitter.com/cedrickrier
identi.ca: http://identi.ca/cedrickrier

Attachment: pgpJuqaDbxxYB.pgp
Description: PGP signature

Reply via email to