A suggested change by Jeremy Wickersheimer "Rounding error in prorating returned adjustments" (https://issues.apache.org/jira/browse/OFBIZ-4038) - OFBIZ-4038
The error is in applications/order/src/org/ofbiz/order/order/OrderReturnServices.java the getAdjustmentAmount method is prorating using this code: newAmount = returnTotal.divide(originalTotal, decimals, rounding).multiply(amount).setScale(decimals, rounding); it should be: newAmount = returnTotal.multiply(amount).divide(originalTotal, decimals, rounding); else by dividing first what should be for example 1/3 of the adjustment ends up being 0.33 JLR: I have added the setScale part git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1042034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -2648,7 +2648,7 @@ public class OrderReturnServices {
|
||||
originalTotal = originalTotal.setScale(decimals, rounding);
|
||||
BigDecimal newAmount = null;
|
||||
if (ZERO.compareTo(originalTotal) != 0) {
|
||||
newAmount = returnTotal.divide(originalTotal, decimals, rounding).multiply(amount).setScale(decimals, rounding);
|
||||
newAmount = returnTotal.multiply(amount).divide(originalTotal, decimals, rounding).setScale(decimals, rounding);
|
||||
} else {
|
||||
newAmount = ZERO;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user