Hello,
i have make customs report by formular and balance is negative so if i want to apply condition Field is negative balance so field = 0
how can i do it ?
Best regard, KH
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
Sure,
Balance if balance > 0 else 0
This means:
If balance is positive, show the balance , If balance is negative or zero, show 0.
<t t-esc="balance if balance > 0 else 0"/>
Or if you're using Python logic inside a computed field or report model:
self.filtered_balance = balance if balance > 0 else 0
This ensures negative values are converted to 0 in your report output.
I trust this information will be useful.
Hi,
In custom reports using formulas, if you want to show a field only when its value is positive, and show zero when it's negative, you can use a conditional formula. For example, suppose your field is named balance. To achieve your requirement, "if balance is negative, then show 0; otherwise show the balance", the formula would be something like:
In Python:
value = balance if balance >= 0 else 0
XML:
<t t-esc="balance if balance >= 0 else 0"/>
Hope it helps.
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
0
oct 25
|
2 | ||
|
1
oct 25
|
691 | ||
|
1
oct 25
|
173 | ||
|
2
oct 25
|
289 | ||
|
1
oct 25
|
310 |