IDEMPIERE-3352 Enhancement of Batch Level Costing. Use safer approach for production reversal checking.

This commit is contained in:
Heng Sin Low 2017-07-04 20:04:16 +08:00
parent 8194d58ec1
commit f4969a172f
1 changed files with 4 additions and 4 deletions

View File

@ -1263,11 +1263,11 @@ public class MCostDetail extends X_M_CostDetail
}
else if (addition)
{
MProductionLine productionLine = (MProductionLine) getM_ProductionLine();
if (productionLine.getProductionReversalId() <= 0)
cost.add(amt, qty);
MProductionLine productionLine = getM_ProductionLine_ID() > 0 ? new MProductionLine(getCtx(), getM_ProductionLine_ID(), get_TrxName()) : null;
if (productionLine != null && productionLine.getProductionReversalId() > 0)
cost.setCurrentQty(cost.getCurrentQty().add(qty));
else
cost.setCurrentQty(cost.getCurrentQty().add(qty));
cost.add(amt, qty);
// Initial
if (cost.getCurrentCostPrice().signum() == 0