How to change the price precision
Introduction
The price precision defined by default in all currencies in Openbravo ERP is two. One of the most common changes when implementing Openbravo ERP in a customer, is to change this price precision because of the requirements of the project. This document tries to clarify the changes needed to perform this precision change.
Execution Steps
There are two main changes to perform the price precision change in Openbravo ERP. Through the UI the administrator has to change the currency precision.
- Login as system administrator
- Navigate to General Setup - Application - Currency
- Filter by the currency you want to change (i.e: EUR - Euro)
- By default price precision is two. Change it to the new value (i.e: 4)
Once the change in currency is done, the rest of the changes are in Format configuration file. Here's how you do it.
- Edit config/Format.xml file
Original lines:
<Number name="priceRelation" decimal="." grouping="," formatOutput="#,##0.00" formatInternal="#0.00" />
<Number name="priceEdition" decimal="." grouping="," formatOutput="#0.00" formatInternal="#0.00" />
If the customer wants always two decimals, and three or four dynamically depending on the number of decimals:
<Number name="priceRelation" decimal="." grouping="," formatOutput="#,##0.00##" formatInternal="#0.00##"/>
<Number name="priceEdition" decimal="." grouping="," formatOutput="#0.00##" formatInternal="#0.00##"/>
If the customer wants always four decimals:
<Number name="priceRelation" decimal="." grouping="," formatOutput="#,##0.0000" formatInternal="#0.0000" />
<Number name="priceEdition" decimal="." grouping="," formatOutput="#0.0000" formatInternal="#0.0000" />
- In command line, execute:
ant compile.complete.deploy
- Restart tomcat
After performing this steps, all the prices in Openbravo will be rounded to 4 decimals.