diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 2180842ddb..2b3b38c527 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1605,16 +1605,12 @@ public class MInOut extends X_M_InOut implements DocAction iLine.saveEx(); // update matched invoice with ASI inv.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); } - boolean isNewMatchInv = false; - if (inv.get_ID() == 0) - isNewMatchInv = true; if (!inv.save(get_TrxName())) { m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching"); 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 MMatchPO po = MMatchPO.create (null, sLine, getMovementDate(), matchQty); if (po != null) { - boolean isNewMatchPO = false; - if (po.get_ID() == 0) - isNewMatchPO = true; if (!po.save(get_TrxName())) { m_processMsg = "Could not create PO Matching"; return DocAction.STATUS_Invalid; } - if (isNewMatchPO) + if (!po.isPosted()) addDocsPostProcess(po); } // Update PO with ASI @@ -1655,15 +1648,12 @@ public class MInOut extends X_M_InOut implements DocAction MMatchPO po = MMatchPO.create (iLine, sLine, getMovementDate(), matchQty); if (po != null) { - boolean isNewMatchPO = false; - if (po.get_ID() == 0) - isNewMatchPO = true; if (!po.save(get_TrxName())) { m_processMsg = "Could not create PO(Inv) Matching"; return DocAction.STATUS_Invalid; } - if (isNewMatchPO) + if (!po.isPosted()) addDocsPostProcess(po); } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index c762d01750..45cff928e0 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -1807,17 +1807,13 @@ public class MInvoice extends X_C_Invoice implements DocAction matchQty = receiptLine.getMovementQty(); MMatchInv inv = new MMatchInv(line, getDateInvoiced(), matchQty); - boolean isNewMatchInv = false; - if (inv.get_ID() == 0) - isNewMatchInv = true; if (!inv.save(get_TrxName())) { m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching"); return DocAction.STATUS_Invalid; } matchInv++; - if (isNewMatchInv) - addDocsPostProcess(inv); + addDocsPostProcess(inv); } // Update Order Line @@ -1845,18 +1841,15 @@ public class MInvoice extends X_C_Invoice implements DocAction BigDecimal matchQty = line.getQtyInvoiced(); MMatchPO po = MMatchPO.create (line, null, getDateInvoiced(), matchQty); - boolean isNewMatchPO = false; if (po != null) { - if (po.get_ID() == 0) - isNewMatchPO = true; if (!po.save(get_TrxName())) { m_processMsg = "Could not create PO Matching"; return DocAction.STATUS_Invalid; } matchPO++; - if (isNewMatchPO) + if (!po.isPosted()) addDocsPostProcess(po); } }