IDEMPIERE-1174 Match PO not posted after material receipt have been posted when client accounting is post immediate.

This commit is contained in:
Heng Sin Low 2013-07-15 15:49:16 +08:00
parent 35c0c89fb6
commit 5c31c19036
2 changed files with 5 additions and 22 deletions

View File

@ -1605,16 +1605,12 @@ public class MInOut extends X_M_InOut implements DocAction
iLine.saveEx(); // update matched invoice with ASI iLine.saveEx(); // update matched invoice with ASI
inv.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); inv.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID());
} }
boolean isNewMatchInv = false;
if (inv.get_ID() == 0)
isNewMatchInv = true;
if (!inv.save(get_TrxName())) if (!inv.save(get_TrxName()))
{ {
m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching"); m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (isNewMatchInv) addDocsPostProcess(inv);
addDocsPostProcess(inv);
} }
} }
@ -1625,15 +1621,12 @@ public class MInOut extends X_M_InOut implements DocAction
// Ship - PO // Ship - PO
MMatchPO po = MMatchPO.create (null, sLine, getMovementDate(), matchQty); MMatchPO po = MMatchPO.create (null, sLine, getMovementDate(), matchQty);
if (po != null) { if (po != null) {
boolean isNewMatchPO = false;
if (po.get_ID() == 0)
isNewMatchPO = true;
if (!po.save(get_TrxName())) if (!po.save(get_TrxName()))
{ {
m_processMsg = "Could not create PO Matching"; m_processMsg = "Could not create PO Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (isNewMatchPO) if (!po.isPosted())
addDocsPostProcess(po); addDocsPostProcess(po);
} }
// Update PO with ASI // Update PO with ASI
@ -1655,15 +1648,12 @@ public class MInOut extends X_M_InOut implements DocAction
MMatchPO po = MMatchPO.create (iLine, sLine, MMatchPO po = MMatchPO.create (iLine, sLine,
getMovementDate(), matchQty); getMovementDate(), matchQty);
if (po != null) { if (po != null) {
boolean isNewMatchPO = false;
if (po.get_ID() == 0)
isNewMatchPO = true;
if (!po.save(get_TrxName())) if (!po.save(get_TrxName()))
{ {
m_processMsg = "Could not create PO(Inv) Matching"; m_processMsg = "Could not create PO(Inv) Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (isNewMatchPO) if (!po.isPosted())
addDocsPostProcess(po); addDocsPostProcess(po);
} }

View File

@ -1807,17 +1807,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
matchQty = receiptLine.getMovementQty(); matchQty = receiptLine.getMovementQty();
MMatchInv inv = new MMatchInv(line, getDateInvoiced(), matchQty); MMatchInv inv = new MMatchInv(line, getDateInvoiced(), matchQty);
boolean isNewMatchInv = false;
if (inv.get_ID() == 0)
isNewMatchInv = true;
if (!inv.save(get_TrxName())) if (!inv.save(get_TrxName()))
{ {
m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching"); m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
matchInv++; matchInv++;
if (isNewMatchInv) addDocsPostProcess(inv);
addDocsPostProcess(inv);
} }
// Update Order Line // Update Order Line
@ -1845,18 +1841,15 @@ public class MInvoice extends X_C_Invoice implements DocAction
BigDecimal matchQty = line.getQtyInvoiced(); BigDecimal matchQty = line.getQtyInvoiced();
MMatchPO po = MMatchPO.create (line, null, MMatchPO po = MMatchPO.create (line, null,
getDateInvoiced(), matchQty); getDateInvoiced(), matchQty);
boolean isNewMatchPO = false;
if (po != null) if (po != null)
{ {
if (po.get_ID() == 0)
isNewMatchPO = true;
if (!po.save(get_TrxName())) if (!po.save(get_TrxName()))
{ {
m_processMsg = "Could not create PO Matching"; m_processMsg = "Could not create PO Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
matchPO++; matchPO++;
if (isNewMatchPO) if (!po.isPosted())
addDocsPostProcess(po); addDocsPostProcess(po);
} }
} }