How can i add disabled class with attributes to field based on CONDITION?
I tried as below methods,
1)
<t t-if="product.qty_available <= 0">
<attribute name="class">btn btn-primary btn-lg mt8 js_check_product a-submit disabled</attribute>
</t>
2)
<attribute name="class" t-if="product.qty_available > 0">btn btn-primary btn-lg mt8 js_check_product a-submit disabled</attribute>
3)
<attribute name="class" >product.qty_available > 0 and 'btn btn-primary btn-lg mt8 js_check_product a-submit' or 'btn btn-primary btn-lg mt8 js_check_product a-submit disabled'</attribute>
Can some one helping me to achieve this?
Did with position="replace"
<xpath expr="//a[@id='add_to_cart']" position="replace">
<a id="add_to_cart" t-attf-class="btn btn-primary btn-lg mt8 js_check_product a-submit #{product.qty_available <= 0 and 'disabled'}" href="#" >Add to Cart</a>
</xpath>