El jueves, 8 de febrero de 2018, 9:55:45 (UTC-6), Sergi Almacellas Abellana 
escribió:
> El 07/02/18 a les 23:01, Josias Pérez ha escrit:
> > Hi,
> > 
> > I have a custom module with the a One2Many field:
> > 
> > 
> > class Agreement(ModelView, ModelSQL):
> >     "Agreement"
> >     __name__ = 'mod.agreement'
> > 
> >     date = fields.Date('Date')
> >     lines = fields.One2Many('disc.agreement.service',
> >         'agreement','Services',
> >         )
> > 
> > class AgreementLine(ModelView, ModelSQL): 
> >     "Agreement Line" 
> >     __name___ = 'mod.agreement.line'
> > 
> >     agreement = fields.Many2One('Agreement')
> >     service = fields.Many2One('mod.service', 'Service') 
> > 
> > class Service(ModelView, ModelSQL):
> >     "Service"
> >     __name__ = 'mod.service'
> > 
> >     name = fields.Char('Name')
> > 
> > Inside this class I have modified the search classmethod and I want to 
> > search Agreements by Service ('mod.service') in Agreement 
> > class('mod.agreement'), is this possible?
> 
> Yes, you can "jump" between relations using a dot to represent a
> relation. For example, the following example will allow you to return
> all the agreement which conaint a line of a service named service:
> 
> [('lines.service.name', '=', 'Service')]
> 
> Hope it helps.
> 
> -- 
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk

Works perfect!

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/4a8cef2d-f26e-4bb0-8fdd-e7abe39c7412%40googlegroups.com.

Reply via email to