Fixes issue
28192: Net Unit Price now is properly calculated.
In order to calculate the Net Unit Price, the adjustments of the transaction are used, but it was not being used the signMultiplier of the transaction, and needs to be used.
--- a/src/org/openbravo/costing/AverageCostAdjustment.java Wed Dec 10 14:09:54 2014 +0100
+++ b/src/org/openbravo/costing/AverageCostAdjustment.java Thu Dec 04 12:20:59 2014 +0100
@@ -281,7 +281,7 @@
log.debug("New average cost: {}", cost.toPlainString());
Costing curCosting = trx.getMaterialMgmtCostingList().get(0);
BigDecimal trxPrice = curCosting.getPrice().multiply(trx.getMovementQuantity().abs())
- .add(trxAdjAmt)
+ .add(trxAdjAmt.multiply(trxSignMultiplier))
.divide(trx.getMovementQuantity().abs(), costCurPrecission, RoundingMode.HALF_UP);
if (checkNegativeStockCorrection && currentStock.compareTo(trx.getMovementQuantity()) < 0
@@ -355,7 +355,7 @@
RoundingMode.HALF_UP);
}
BigDecimal trxPrice = curCosting.getPrice().multiply(trx.getMovementQuantity().abs())
- .add(trxAdjAmt)
+ .add(trxAdjAmt.multiply(trxSignMultiplier))
.divide(trx.getMovementQuantity().abs(), costCurPrecission, RoundingMode.HALF_UP);
if (curCosting.getCost().compareTo(cost) != 0) {
curCosting.setPermanent(Boolean.FALSE);