Domanda

I need to get max value from a list (that I think should be created first somehow).

There is sale.order class / object, from which RML report is generated. It has one2many relation with sale.order.line, which has field (or column) delay. So I need to check every line that is in that order and return max delay value, which would indicate delivery time (like if all products would be delivered at same time).

So for example to get first delay value from first line I can right something like this:

<para>[[ o.order_line[0].delay ]]</para>

Or I can output all values like this:

<para>[[ repeatIn(o.order_line,'l') ]]</para>

And then try something like:

<para>[[ max(l.delay) ]]</para>

But I get error that float can't be iterated (because you need to use list here). What could I do to create list from those values and then get max value? Or maybe there is some other way to get max value in RML?

È stato utile?

Soluzione

Try [[ max([ln.delay for ln in o.order_line ]) ]]

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top