Odoo Help


Qweb report sort by and multi lines if number of code in a field exceed X number

Christian Parent
on 4/15/14, 10:30 AM 7,358 views

When working with qweb reports, is it possible to sort it ascending by internal reference ?

Also, I have a field which is called designation, it has the position on the board where to solder components. Is it possible to add a counter that after, lets say 10, components, it will add a new line in the fields and continue listing on the next line ?

                        <t t-foreach="docs" t-as="o">
                        <tr t-foreach="get_children(o.bom_lines)" t-as="l">

Sort ascending by pcode !!!

                                    <span t-esc="l['pcode']"/>
                                <span t-esc="formatLang(l['pqty'])"/>
                                <span t-esc="l['uname']" groups="product.group_uom"/>

Designation is hard coded for now but will come from a field named designation. After printing 10 numbers, it would make a new line a keep going for 10 more.

                            <td>R1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,20.</td>
                                <span style="color: white;" t-esc="'... '*(l['level'])"/>
                                <span t-esc="l['name']"/>
                                <span t-esc="l['spcode']"/>
                                <span t-esc="l['qavail']"/>

Is it possible ?

On 11/14/15, 11:45 AM


If you want sort an object in qweb try:

Eg: I want to sort all sale order by partner name in my report:

<t-as="l" t-foreach="o.order_ids.sorted(key=lambda b: b.partner_id.name)">
<span t-field="l.partner_id.name"/>

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 4/15/14, 10:30 AM
Seen: 7358 times
Last updated: 8/18/17, 3:40 PM