1003754 Landed cost issue -- related to IDEMPIERE-1285. Fixed the transfer of invoice price variance to product cost for average invoice and average po costing.

This commit is contained in:
Heng Sin Low 2014-02-07 16:48:44 +08:00
parent 5f2afcf93a
commit a6bbb96983
2 changed files with 22 additions and 0 deletions

View File

@ -403,6 +403,16 @@ public class Doc_MatchInv extends Doc
as.getC_Currency_ID(), ipv.negate());
updateFactLine(line);
line = fact.createLine(null, account, as.getC_Currency_ID(), ipv);
updateFactLine(line);
} else if (X_M_Cost.COSTINGMETHOD_AverageInvoice.equals(costingMethod) && !zeroQty) {
MAccount account = m_pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as);
FactLine line = fact.createLine(null,
m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as),
as.getC_Currency_ID(), ipv.negate());
updateFactLine(line);
line = fact.createLine(null, account, as.getC_Currency_ID(), ipv);
updateFactLine(line);
}

View File

@ -1828,6 +1828,18 @@ public class MInvoice extends X_C_Invoice implements DocAction
matchPO++;
if (!po.isPosted() && po.getM_InOutLine_ID() > 0) // match po don't post if receipt is not assigned, and it doesn't create avg po record
addDocsPostProcess(po);
MMatchInv[] matchInvoices = MMatchInv.getInvoiceLine(getCtx(), line.getC_InvoiceLine_ID(), get_TrxName());
if (matchInvoices != null && matchInvoices.length > 0)
{
for(MMatchInv matchInvoice : matchInvoices)
{
if (!matchInvoice.isPosted())
{
addDocsPostProcess(matchInvoice);
}
}
}
}
}
}