Odoo Help

Welcome!

This community 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.

1

How To group by product category in qweb report ?

By
MouBou
on 6/2/16, 12:24 PM 902 views

Hello Community ,I'm facing a probleme ,i want to create an invoice wich show the list of product sales grouped by category 

i tried this

<t t-foreach="o.order_line" t-as="l">

<t t-if="l.product_id.categ_id">

<tr>  <td>

<span t-field="l.product_id.categ_id"/>

</td> </tr> </t>


but dosen't groub all products it show this result:

category 1

product 1

category 1

product 2


i want this resulat 

category 1

product 1

product 2

etc ...

thanks in advance


4

Jusab Sida (jsi)

--Jusab Sida (jsi)--
Tiny ERP Pvt Ltd
http://www.odoo.com
874
| 2 1 5
Gandhinagar, India
--Jusab Sida (jsi)--


Jusab Sida (jsi)
On 6/3/16, 8:50 AM

Here is the code for grouping...

<t t-set="product_category" t-value="[]"/>

<t t-foreach="o.order_line" t-as="l">

<t t-set="product_category" t-value="product_category+[l.product_id.categ_id]"/>

</t>

<t t-foreach="set(product_category)" t-as="category">

<div><strong t-esc="category.name"/></div>

<t t-foreach="o.order_line" t-as="l">

<t t-if="category.id==l.product_id.categ_id.id">

<div><span t-field="l.product_id"/></div>

</t>

</t>

</t>

Thanks so much Jusab. Big help.

Giezel Esteves
on 11/7/16, 9:58 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/2/16, 12:24 PM
Seen: 902 times
Last updated: 9/21/16, 4:38 AM