How to remove the .00 from the price on the website if it is a whole number? or Are there any plugins in the app marketplace?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- 会計
- 在庫
- PoS
- プロジェクト
- MRP
この質問にフラグが付けられました
Hi,
To remove ".00" from whole number prices on your Odoo website, customize the website theme by modifying the QWeb template responsible for rendering the price. Use the t-esc directive with a Python format string to conditionally remove the ".00" if the price is a whole number.
<t t-esc="int(price) if price == int(price) else '%.2f' % price"/>
This logic checks if the price is a whole number and removes decimals when unnecessary.
Alternatively, you could modify the monetary widget, but this affects all monetary fields in Odoo. Check the Odoo App Store for plugins, but evaluate them carefully. Customizing the theme is the recommended approach for targeted control.
Hope it helps
The price displayed on the website is derived directly from the Sales Price field, which is a float-type field. This means Odoo automatically formats the price with two decimal places (e.g., 750.00).
However, if you want to hide the decimals for whole numbers, you can achieve this by customizing the website template.