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

ODOO Use invisible attrs on field | Condition: If the number is 0.0

By
Mohammed Kamar-eddine
on 8/30/16, 10:42 AM 464 views

In Odoo when you have an xpath you can add "attrs" to a field invisible, when a condition is met. This works fine.

I have a field DISCOUNT that i want to display on INVOICE/QUOTATION report only if one of the products hold a DISCOUNT value more than 0.0 (i.e - that product has a discount given to it

CODE:

    <td style="border: 0.5px solid black;background-color:#E6E6E6;">
        <span t-field="l.total_discount" /> 
    </td>

I want to add:

    attrs="{'invisible': [('total_discount','=',0.0)]}"

But i dont know if this is the correct code above.

Normally, this code should hide all tables of discount if they all equal zero (there's no use of placing a discount block if discount is zero)

Please let me know if am somewhat unclear, in any aspect.

Thanks alot.!

1

Bejaoui Souheil

--Bejaoui Souheil--
808
| 2 1 4
Sousse, Tunisia
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant

souheil_bejaoui@hotmail.fr

Bejaoui Souheil
On 9/24/16, 3:08 PM

Hi,

 In QWEB report you can use the t-if statement like this.

<td style="border: 0.5px solid black;background-color:#E6E6E6;">

<span t-if="l.total_discount != 0" t-field="l.total_discount" />

</td>

Best regards.

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: 8/30/16, 10:42 AM
Seen: 464 times
Last updated: 9/24/16, 3:08 PM