On 09 Jul 03:48, Paul Leverett wrote: > > > When using <for each...> in an odt report template, is it possible to > define the output order differently from the form they're coming from?
Not directly. The order of a One2Many field is the one define on it [1] if
it is or the default one [2] of the target.
> e.g. order the following by output.product.rec_name instead of the order
> they appear in the form?
But you can use sorted [3]:
for each="output in sorted(production.outputs, key=lambda o:
o.product.rec_name)"
> <for each="output in production.outputs">
> <output.product.rec_name>
> </for>
[1]
http://doc.tryton.org/3.2/trytond/doc/ref/models/fields.html?highlight=one2many#trytond.model.fields.One2Many.order
[2]
http://doc.tryton.org/3.2/trytond/doc/ref/models/models.html?highlight=_order#trytond.model.ModelSQL._order
[3] https://docs.python.org/2/library/functions.html#sorted
--
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
pgpccb1Qquvfu.pgp
Description: PGP signature
