Discussion:
[tryton] Add the order_field method to a function field
Luciano Rossi
2018-01-22 21:41:42 UTC
Permalink
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 - ***@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
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/c5e7f856-02ef-6933-fdb2-887d0d578f38%40gcoop.coop.
Luciano Rossi
2018-01-23 07:17:56 UTC
Permalink
Post by Luciano Rossi
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!
--
Luciano Rossi - ***@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
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/b6353c7d-c143-0789-ebd6-861f07be35bd%40gcoop.coop.
Maxime Richez
2018-01-23 08:26:48 UTC
Permalink
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)
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/09c5e396-f3f5-4627-b44d-aea48f01dd7f%40googlegroups.com.
Loading...