Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0057893Openbravo ERP06. Material requirement planning (MRP)public2025-02-03 14:062025-02-11 07:37
javietxe 
kousalya_r 
normalmajorhave not tried
closedfixed 
5
 
PR24Q4.2PR24Q4.1 
Core
No
0057893: BigDecimal.divide(BigDecimal) does not specify a rounding mode
There is an arithmetic division that is not being handled correctly in the class ServicePriceUtils.java .
 
In the getServiceAmoutnt method, if olsr.getAmount() and olsr.getQuantity() result in a non-terminating decimal expansion, such as: 10 / 3 = 3.3333333333... Java throws ArithmeticException.
In Terrena happening due to a customization.
Add the precision and rounding in the next lines.

Class:
openbravo/src/org/openbravo/materialmgmt/ServicePriceUtils.java

Method
getServiceAmount

Lines:
        relatedPrices.put(olsr.getQuantity().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO
            : olsr.getAmount().divide(olsr.getQuantity()));

No tags attached.
blocks defect 0057841 closed kousalya_r BigDecimal.divide(BigDecimal) does not specify a rounding mode 
Issue History
2025-02-06 14:02jonaeTypedefect => backport
2025-02-06 14:02jonaeTarget Version => PR24Q4.2
2025-02-10 07:55hgbotNote Added: 0175360
2025-02-11 07:37hgbotResolutionopen => fixed
2025-02-11 07:37hgbotStatusscheduled => closed
2025-02-11 07:37hgbotNote Added: 0175448
2025-02-11 07:37hgbotFixed in Version => PR24Q4.1
2025-02-11 07:37hgbotNote Added: 0175449

Notes
(0175360)
hgbot   
2025-02-10 07:55   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1528 [^]
(0175448)
hgbot   
2025-02-11 07:37   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1528 [^]
(0175449)
hgbot   
2025-02-11 07:37   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo [^]
Changeset: ae9e32881b3587f70f726548807abda19fbf9fb4
Author: Kousalya Ramasamy <k.ramasamy@external.orisha.com>
Date: 10-02-2025 12:23:49
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/commit/ae9e32881b3587f70f726548807abda19fbf9fb4 [^]

Fixed ISSUE-57893: Added Rounding mode to handle non-terminating arthimetic exception

---
M src/org/openbravo/materialmgmt/ServicePriceUtils.java
---