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.

0

How to filter Invoice reports by product variants

By
Randall Risser
on 3/8/16, 11:24 AM 481 views

I currently have Odoo V9 online cloud version.

Is there any way to filter the report by the invoices that contain a product with a certain variants.

Example: I have a T-shirt with Variants of Red, Brown, Blue.

I only want the invoices to show in the report that have the product T-shirt with the Variant of Blue

1
William Brugger
On 3/8/16, 3:19 PM

You have to edit the qweb view "report_saleorder_document" and add t-if statements.   I have a template where I filter bom materials based on their product category.  So at the top of each table I put this:

<tbody>

<t t-if="o.move_lines">

<t t-foreach="o.bom_id.bom_line_ids" t-as="line">

<t t-if="line.product_id.product_tmpl_id.categ_id.id==4">

<tr>

<td> 

<span t-field="line.name"/>

</td>  etc...


In your case you will want to check the variant at the top of the loop over items on your sales order.

<t t-if="line.product_id.attribute_value_ids.name == 'blue'">  or if you know the id of that variant

<t t-if="line.product_id.attribute_value_ids.id==3">

 There is a lot of help for customizing reports - just Google odoo qweb custom reports.



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: 3/8/16, 11:24 AM
Seen: 481 times
Last updated: 5/11/16, 11:21 AM