How to sum value if value < 0 if > 0 Subtract the value
span t-if="move.forecast availability < 0 == 'move.product_uom_qty+move.forecast_availabilty'"
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How to sum value if value < 0 if > 0 Subtract the value
span t-if="move.forecast availability < 0 == 'move.product_uom_qty+move.forecast_availabilty'"
Hi Ahmed Mokhtar,
Your Description is too short, but as per my understanding, please try with below code
< t t-set="subtotal" t-value="move.product_uom_qty" / >
< t t-if="move.forecast availability < 0 >
< t t-set="subtotal" t-value="subtotal + move.forecast_availabilty" / >
< /t >
< t t-if="move.forecast availability > 0 >
< t t-set="subtotal" t-value="subtotal - move.forecast_availabilty" / >
< /t >
Please Vote for the Answer if it helps.
it's give me
lxml.etree.XMLSyntaxError: error parsing attribute name
in line
< t t-if="move.forecast availability < 0 >
i think < or > not working in the code
Yes, you need to use < for < and > for >
is this code is right
<t t-set="subtotal" t-value="move.product_uom_qty" />
<t t-if="move.forecast availability < 0" >
<t t-set="subtotal" t-value="subtotal + move.forecast_availabilty" />
</t>
<t t-if="move.forecast availability > 0">
<t t-set="subtotal" t-value="subtotal - move.forecast_availabilty" />
</t>
it's give me error
Error when compiling xml template
SyntaxError: invalid syntax (<>, line 1)
Template: stock.report_delivery_document_copy_3
Path: /t/t/t/div/table[1]/tbody/tr[1]/td[4]/t[2]/t
Node: < t t-set="subtotal" t-value="subtotal + move.forecast_availabilty"/>
Please check the syntax and spaces.
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký