Average Costing & Landed Cost fixes
This commit is contained in:
parent
5e046a0b8a
commit
13c055c0ed
|
@ -2141,6 +2141,24 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
if (alloc.processIt(DocAction.ACTION_Complete))
|
||||
alloc.save();
|
||||
}
|
||||
|
||||
//MZ Goodwill
|
||||
if (!invoice.isSOTrx())
|
||||
{
|
||||
// delete Matched Invoice Cost Detail
|
||||
MInvoiceLine[] lines = invoice.getLines();
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
MCostDetail cd = MCostDetail.get (invoice.getCtx(), "C_InvoiceLine_ID=? AND M_AttributeSetInstance_ID=?",
|
||||
lines[i].getC_InvoiceLine_ID(), lines[i].getM_AttributeSetInstance_ID(), invoice.get_TrxName());
|
||||
if (cd != null)
|
||||
{
|
||||
cd.setProcessed(false);
|
||||
cd.delete(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
//End MZ
|
||||
// After reverseCorrect
|
||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
|
||||
if (m_processMsg != null)
|
||||
|
|
|
@ -2018,6 +2018,29 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
if (!createReversals())
|
||||
return false;
|
||||
|
||||
//MZ Goodwill
|
||||
if (!order.isSOTrx())
|
||||
{
|
||||
// delete Matched PO Cost Detail
|
||||
MOrderLine[] lines = order.getLines();
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
MMatchPO[] mPO = MMatchPO.getOrderLine(order.getCtx(), lines[i].getC_OrderLine_ID(), order.get_TrxName());
|
||||
// delete Cost Detail if the Matched PO has been deleted
|
||||
if (mPO.length == 0)
|
||||
{
|
||||
MCostDetail cd = MCostDetail.get(order.getCtx(), "C_OrderLine_ID=? AND M_AttributeSetInstance_ID=?",
|
||||
lines[i].getC_OrderLine_ID(), lines[i].getM_AttributeSetInstance_ID(), order.get_TrxName());
|
||||
if (cd != null)
|
||||
{
|
||||
cd.setProcessed(false);
|
||||
cd.delete(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//End MZ
|
||||
|
||||
// After Void
|
||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
|
||||
if (m_processMsg != null)
|
||||
|
|
Loading…
Reference in New Issue