support Click to see our new support page.
support For sales enquiry!

Enhancing User Experience with Human-Readable Numeric Fields in Odoo 17

numeric fields in odoo

Aswini MMJuly 1, 2024

Introduction


In the fast-paced world of business software, clarity and efficiency are key. Large
numbers, especially in financial data, can sometimes be cumbersome to read
quickly. Odoo 17 introduces a new feature that allows developers to display numeric
fields using human-readable abbreviations, such as 500k instead of 500,000. This
blog post will guide you through implementing this feature, enhancing the user
interface, and improving data readability.


Why Use Human-Readable Numeric Fields?


Human-readable numeric fields transform large numbers into shorter, easily
understandable formats. This not only makes data more accessible at a glance but
also reduces the cognitive load on users who need to process this information
quickly.


To implement this feature, you need to make changes in both the backend (Python
code) and the frontend (XML views and potentially JavaScript for custom widgets).
Here’s a step-by-step guide:


Firstly,we need to define a Computed Field

sale_order.py

Next, update the form view to display the human-readable computed field.
sale_order.xml

Create a custom widget inside the folder static/components/widget/readable.js
readable.js

Now you need to add the following XML code to the template for the widget setup.
The template is loaded into static/components/widget/readable.xml

readable.xml

 

Now,register the widget in your created XML form view

Load all the files in your __manifest__.py file

 

Conclusion
Odoo 17's ability to display human-readable numeric fields significantly enhances
data readability and user experience. By following the steps outlined in this guide,
developers can easily implement this feature, making large numbers more
accessible and understandable for users.

0

Subscribe to our Newsletter

Sign up to receive more information about our latest offers & new product announcement and more.