Hi,
It's easier to explain my question with this example.
I have the following products on a quotation:
PRODUCT | VARIANT | QUANTITY | PRICE |
T-Shirt | Blue | 1 | $100 |
T-Shirt | Red | 1 | $100 |
Pants | Blue | 1 | $100 |
Pants | Black | 1 | $100 |
Hat | Black | 1 | $100 |
I'm trying to add a list of unique (distinct) products with their description and image to report_saleorder_document, like this:
T-Shirt | |
T-Shirt's sale description | T-Shirt's image |
Pants | |
Pants' sale description | Pants' image |
Hat | |
Hat's sale description | Hat's image |
My code so far (thanks to @Niyas Raphy for his help)
<t t-foreach="set(doc.order_line.mapped('product_id'))" t-as="x">
<table border="0" width="100%">
<thead>
<tr>
<th style="background: #F0F0F0; text-align: left">
<p><t t-esc="x.name"/></p>
</th>
<th style="background: #F0F0F0; text-align: left">
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 70%; text-align: justify; vertical-align: top;">
<p><t t-esc="x.description_sale"/></p>
</td>
<td style="width: 70%; text-align: justify; vertical-align: top;">
<img t-attf-src="data:image/*;base64,{{x.product_id.image_1920}}"/>
</td>
</tr>
</tbody>
</table>
</t>
But this code doesn't give me unique (distinct) products, it repeats the products that have already been listed and the result is something like this
T-Shirt
T-Shirt's sale description + image
T-Shirt
T-Shirt's sale description + image
...
How can I change my code to get only unique products names/description/image?