[ 1693997 ] Calculation of cost should happen when transaction complete
This commit is contained in:
parent
148d0ad69a
commit
077f4f6b00
|
@ -145,9 +145,9 @@ public class Doc_MatchPO extends Doc
|
||||||
tAmt = tAmt.add(poCost.multiply(qty));
|
tAmt = tAmt.add(poCost.multiply(qty));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
poCost = poCost.multiply(getQty()); // Delivered so far
|
||||||
tAmt = tAmt.add(isReturnTrx ? poCost.negate() : poCost);
|
tAmt = tAmt.add(isReturnTrx ? poCost.negate() : poCost);
|
||||||
tQty = tQty.add(isReturnTrx ? getQty().negate() : getQty());
|
tQty = tQty.add(isReturnTrx ? getQty().negate() : getQty());
|
||||||
poCost = poCost.multiply(getQty()); // Delivered so far
|
|
||||||
|
|
||||||
// Different currency
|
// Different currency
|
||||||
String costingMethod = as.getCostingMethod();
|
String costingMethod = as.getCostingMethod();
|
||||||
|
|
|
@ -1564,23 +1564,6 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
BigDecimal poCost = m_oLine.getPriceCost();
|
BigDecimal poCost = m_oLine.getPriceCost();
|
||||||
if (poCost == null || poCost.signum() == 0)
|
if (poCost == null || poCost.signum() == 0)
|
||||||
poCost = m_oLine.getPriceActual();
|
poCost = m_oLine.getPriceActual();
|
||||||
poCost = poCost.multiply(po.getQty()); // Delivered so far
|
|
||||||
// Different currency
|
|
||||||
if (m_oLine.getC_Currency_ID() != as.getC_Currency_ID())
|
|
||||||
{
|
|
||||||
MOrder order = m_oLine.getParent();
|
|
||||||
BigDecimal rate = MConversionRate.getRate(
|
|
||||||
order.getC_Currency_ID(), as.getC_Currency_ID(),
|
|
||||||
order.getDateAcct(), order.getC_ConversionType_ID(),
|
|
||||||
m_oLine.getAD_Client_ID(), m_oLine.getAD_Org_ID());
|
|
||||||
if (rate == null)
|
|
||||||
{
|
|
||||||
return "Purchase Order not convertible - " + as.getName();
|
|
||||||
}
|
|
||||||
poCost = poCost.multiply(rate);
|
|
||||||
if (poCost.scale() > as.getCostingPrecision())
|
|
||||||
poCost = poCost.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source from Doc_MatchPO.createFacts(MAcctSchema)
|
// Source from Doc_MatchPO.createFacts(MAcctSchema)
|
||||||
MInOutLine receiptLine = new MInOutLine (getCtx(), po.getM_InOutLine_ID(), po.get_TrxName());
|
MInOutLine receiptLine = new MInOutLine (getCtx(), po.getM_InOutLine_ID(), po.get_TrxName());
|
||||||
|
@ -1604,9 +1587,10 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
tAmt = tAmt.add(poCost.multiply(qty));
|
tAmt = tAmt.add(poCost.multiply(qty));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
poCost = poCost.multiply(po.getQty()); // Delivered so far
|
||||||
tAmt = tAmt.add(isReturnTrx ? poCost.negate() : poCost);
|
tAmt = tAmt.add(isReturnTrx ? poCost.negate() : poCost);
|
||||||
tQty = tQty.add(isReturnTrx ? po.getQty().negate() : po.getQty());
|
tQty = tQty.add(isReturnTrx ? po.getQty().negate() : po.getQty());
|
||||||
poCost = poCost.multiply(po.getQty()); // Delivered so far
|
|
||||||
|
|
||||||
// Different currency
|
// Different currency
|
||||||
String costingMethod = as.getCostingMethod();
|
String costingMethod = as.getCostingMethod();
|
||||||
|
|
Loading…
Reference in New Issue