IDEMPIERE-188 Average Costing: Reversal of shipment shouldn't increase Accumulated Qty and Accumulated Amt

This commit is contained in:
Heng Sin Low 2012-03-09 10:14:23 +08:00
parent e16e2e2525
commit f2f9da5add
1 changed files with 16 additions and 0 deletions

View File

@ -1046,7 +1046,15 @@ public class MCostDetail extends X_M_CostDetail
if (ce.isAverageInvoice()) if (ce.isAverageInvoice())
{ {
if (addition) if (addition)
{
cost.setWeightedAverage(amt, qty); cost.setWeightedAverage(amt, qty);
//shouldn't accumulate reversal of customer shipment qty and amt
if (isShipment())
{
cost.setCumulatedQty(history.getOldCQty());
cost.setCumulatedAmt(history.getOldCAmt());
}
}
else else
cost.setCurrentQty(cost.getCurrentQty().add(qty)); cost.setCurrentQty(cost.getCurrentQty().add(qty));
log.finer("QtyAdjust - AverageInv - " + cost); log.finer("QtyAdjust - AverageInv - " + cost);
@ -1054,7 +1062,15 @@ public class MCostDetail extends X_M_CostDetail
else if (ce.isAveragePO()) else if (ce.isAveragePO())
{ {
if (addition) if (addition)
{
cost.setWeightedAverage(amt, qty); cost.setWeightedAverage(amt, qty);
//shouldn't accumulate reversal of customer shipment qty and amt
if (isShipment())
{
cost.setCumulatedQty(history.getOldCQty());
cost.setCumulatedAmt(history.getOldCAmt());
}
}
else else
cost.setCurrentQty(cost.getCurrentQty().add(qty)); cost.setCurrentQty(cost.getCurrentQty().add(qty));
log.finer("QtyAdjust - AveragePO - " + cost); log.finer("QtyAdjust - AveragePO - " + cost);