Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0057841Openbravo ERP06. Material requirement planning (MRP)public2025-02-03 14:062025-02-11 07:36
javietxe 
kousalya_r 
normalmajorhave not tried
closedfixed 
5
 
PR25Q2 
Core
No
0057841: 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.
depends on backport 0057892PR25Q1 closed kousalya_r BigDecimal.divide(BigDecimal) does not specify a rounding mode 
depends on backport 0057893PR24Q4.2 closed kousalya_r BigDecimal.divide(BigDecimal) does not specify a rounding mode 
Issue History
2025-02-03 14:06javietxeNew Issue
2025-02-03 14:06javietxeAssigned To => Triage Omni OMS
2025-02-03 14:06javietxeModules => Core
2025-02-03 14:06javietxeTriggers an Emergency Pack => No
2025-02-03 14:06javietxeIssue Monitored: javietxe
2025-02-05 08:08jonaeNote Added: 0175136
2025-02-05 08:08jonaeAssigned ToTriage Omni OMS => kousalya_r
2025-02-05 08:50hgbotNote Added: 0175147
2025-02-06 14:02jonaeStatusnew => scheduled
2025-02-11 07:36hgbotNote Added: 0175446
2025-02-11 07:36hgbotResolutionopen => fixed
2025-02-11 07:36hgbotStatusscheduled => closed
2025-02-11 07:36hgbotFixed in Version => PR25Q2
2025-02-11 07:36hgbotNote Added: 0175447

Notes
(0175136)
jonae   
2025-02-05 08:08   
Jira - https://openbravo.atlassian.net/browse/RM-20986 [^]
(0175147)
hgbot   
2025-02-05 08:50   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1520 [^]
(0175446)
hgbot   
2025-02-11 07:36   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1520 [^]
(0175447)
hgbot   
2025-02-11 07:36   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo [^]
Changeset: a4095963e4e5322a65bedb671b311e9ab0f18e78
Author: Kousalya Ramasamy <k.ramasamy@external.orisha.com>
Date: 11-02-2025 06:36:20
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/commit/a4095963e4e5322a65bedb671b311e9ab0f18e78 [^]

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

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