Hello Devs,

Ofbiz places a restriction on saving more than 3 decimal places in price
related entity-fields. But there can be a number of use cases where a user
needs to store more than 2 or 3 decimal places in the currency related
entity-fields.

I even saw some discussions related to this but didn't found any
conclusions from them. Even one issue
<https://issues.apache.org/jira/browse/OFBIZ-494> has been created but for
limited fields. So, I would like to propose support for multiple or more
than 2/3 decimals in price related fields.

Following are some findings related to the currency fields which would be
helpful to examine the requirement:
Ofbiz uses two field types to store the currency related entity-fields.
These two types are 'currency-amount' and 'currency-precise' with their
respective types being NUMBER(18,2) and NUMBER(18,3).

Upon initial research, one can conclude that changing the field definitions
of 'currency-amount' and 'currency-precise' would achieve the requirement.
But doing so will raise following questions which need to be answered. Feel
free to add in them.

   - What would be the precise value of precision(number of decimals)?
   - Will these changes can make the system inconsistent?

In addition, I would like to know the significance of having two separate
field types, i.e. 'currency-amount' and 'currency-precise'.

Also, I have marked one improvement which will be needed to realize the
solution. There are multiple occurrences where hardcoded scaling of 2 has
been set to either display or store a currency field. This needs to be
changed and must be set dynamically.

I'd like to hear your thoughts.

Thanks,
*Chinmay Patidar*

Reply via email to