Limit of One2Many

31 views
Skip to first unread message

Vincent Bastos

unread,
Nov 23, 2016, 7:38:40 PM11/23/16
to tryton-dev
How can I see what the maximum number of id's a One2Many field returns?

Nicolas Évrard

unread,
Nov 24, 2016, 3:37:37 AM11/24/16
to tryton-dev
* Vincent Bastos [2016-11-24 01:38 +0100]:
>How can I see what the maximum number of id's a One2Many field returns?

Just specify size=… in the definition of the One2Many

http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html#trytond.model.fields.One2Many.size

--
Nicolas Évrard - B2CK SPRL
E-mail/Jabber: nicolas...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Vincent Bastos

unread,
Nov 24, 2016, 4:22:10 AM11/24/16
to tryto...@googlegroups.com
On Thu, Nov 24, 2016 at 6:37 PM, Nicolas Évrard <nicolas...@b2ck.com> wrote:
* Vincent Bastos  [2016-11-24 01:38 +0100]:
How can I see what the maximum number of id's a One2Many field returns?

Just specify size=… in the definition of the One2Many

http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html#trytond.model.fields.One2Many.size

I thought that field was used to limit the number of records?

I didn't want to limit the number of child records. I wanted to limit the number of id's returned in a model.x.read call.

It's ok though, I am no longer using the one2many field to get some ids'.

Cheers

--
Vincent Bastos
Lava Lab Software

Cédric Krier

unread,
Nov 24, 2016, 4:30:03 AM11/24/16
to tryto...@googlegroups.com
On 2016-11-24 19:22, Vincent Bastos wrote:
> On Thu, Nov 24, 2016 at 6:37 PM, Nicolas Évrard <nicolas...@b2ck.com>
> wrote:
>
> > * Vincent Bastos [2016-11-24 01:38 +0100]:
> >
> >> How can I see what the maximum number of id's a One2Many field returns?
> >>
> >
> > Just specify size=… in the definition of the One2Many
> >
> > http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html
> > #trytond.model.fields.One2Many.size
>
>
> I thought that field was used to limit the number of records?
>
> I didn't want to limit the number of child records. I wanted to limit the
> number of id's returned in a model.x.read call.

You can not because reading a One2Many means getting all the values for
data integrity.

> It's ok though, I am no longer using the one2many field to get some ids'.

Of course, if you want just some (which means it is not really a
One2Many) the proper way is to use a relate action (searching on the
target model with the right domain and limit).

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Reply all
Reply to author
Forward
0 new messages