This problem I have encountered. I have to edit the code in MCost.java and MCostDetail.java.
In file MCost.java:
method setWeightedAverage (BigDecimal amt, BigDecimal qty) , you add param MovementType.
I not calculate cost when MovementType in ('V-','C+')
if (Util.isEmpty(MovementType)
|| (!Util.isEmpty(MovementType)
&& (!MovementType.equals("V-") && !MovementType.equals("C+")))) {
BigDecimal oldSum = getCurrentCostPrice().multiply(getCurrentQty());
BigDecimal newSum = amt;
BigDecimal sumAmt = oldSum.add(newSum);
BigDecimal sumQty = getCurrentQty().add(qty);
if (sumQty.signum() != 0)
{
BigDecimal cost = sumAmt.divide(sumQty, 12, RoundingMode.HALF_UP);
setCurrentCostPrice(cost);
}
}
you can refer to this solution