Add the order_field method to a function field

41 views
Skip to first unread message

Luciano Rossi

unread,
Jan 22, 2018, 4:41:54 PM1/22/18
to try...@googlegroups.com
Hi everybody!

I have a function field that depends on a many2one. I display this field
inside a tree view. I wanted to be sortable, so I found this doc[0] that
talks about it. The examples inside the code[1] are all about to sort
from a field that is from the same table. I will want to sort from a
different table, but I do not understand how to write that kind of code.

[0] http://doc.tryton.org/4.4/trytond/doc/ref/models/fields.html#ordering
[1] http://hg.tryton.org/modules/timesheet/file/tip/line.py#l287

PS: I also asked this question at irc, but nobody reply, and I need it
to leave. That's why I'm asking also here.

Thanks!
--
Luciano Rossi - lu...@gcoop.coop
http://gcoop.coop - Cooperativa de Software Libre
Julián Alvarez 958 CABA C1414DRT +54 11 4771-0055

Visitá www.tiendas.coop - www.nube.coop

Luciano Rossi

unread,
Jan 23, 2018, 2:18:29 AM1/23/18
to try...@googlegroups.com
El 22/01/18 a las 18:41, Luciano Rossi escribió:
> Hi everybody!
>
> I have a function field that depends on a many2one. I display this field
> inside a tree view. I wanted to be sortable, so I found this doc[0] that
> talks about it. The examples inside the code[1] are all about to sort
> from a field that is from the same table. I will want to sort from a
> different table, but I do not understand how to write that kind of code.
>
> [0] http://doc.tryton.org/4.4/trytond/doc/ref/models/fields.html#ordering
> [1] http://hg.tryton.org/modules/timesheet/file/tip/line.py#l287
>
> PS: I also asked this question at irc, but nobody reply, and I need it
> to leave. That's why I'm asking also here.
>
> Thanks!

Hi,

Researching, I found a betters examples of what I was looking for and
help me to write the order_ method.

http://hg.tryton.org/modules/account/file/tip/move.py#l890
http://hg.tryton.org/modules/product/file/tip/product.py#l298

Cheers!

Maxime Richez

unread,
Jan 23, 2018, 3:26:48 AM1/23/18
to tryton
Hi Lucio,

We had also to do a sort on a function field.
Another example here: https://codereview.tryton.org/31881002/diff/330001/purchase.py#317 (line 317)

Reply all
Reply to author
Forward
0 new messages