IDEMPIERE-1174 Found avg po cost detail record was not being created when following flow PO->Inv->Receipt - force the posting of matchpo just when receipt is associated

This commit is contained in:
Carlos Ruiz 2013-07-17 19:47:09 -05:00
parent 180a720f25
commit 46585842d2
2 changed files with 8 additions and 3 deletions

View File

@ -126,14 +126,19 @@ public class Doc_MatchPO extends Doc
ArrayList<Fact> facts = new ArrayList<Fact>();
//
if (getM_Product_ID() == 0 // Nothing to do if no Product
|| getQty().signum() == 0
|| m_M_InOutLine_ID == 0) // No posting if not matched to Shipment
|| getQty().signum() == 0)
{
if (log.isLoggable(Level.FINE)) log.fine("No Product/Qty - M_Product_ID=" + getM_Product_ID()
+ ",Qty=" + getQty());
return facts;
}
if (m_M_InOutLine_ID == 0) // No posting if not matched to Shipment
{
p_Error = "No posting if not matched to Shipment";
return null;
}
// create Fact Header
Fact fact = new Fact(this, as, Fact.POST_Actual);
setC_Currency_ID(as.getC_Currency_ID());

View File

@ -1849,7 +1849,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
return DocAction.STATUS_Invalid;
}
matchPO++;
if (!po.isPosted())
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);
}
}