diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index ccf81dcc53..49136f9a05 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -39,6 +39,7 @@ import org.compiere.print.MPrintFormat; import org.compiere.print.ReportEngine; import org.compiere.process.DocAction; import org.compiere.process.DocumentEngine; +import org.compiere.process.IDocsPostProcess; import org.compiere.process.ProcessInfo; import org.compiere.process.ServerProcessCtl; import org.compiere.util.CLogger; @@ -67,7 +68,7 @@ import org.compiere.util.TimeUtil; *
  • BF [ 2993853 ] Voiding/Reversing Receipt should void confirmations * https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2993853&group_id=176962 */ -public class MInOut extends X_M_InOut implements DocAction +public class MInOut extends X_M_InOut implements DocAction, IDocsPostProcess { /** * @@ -1801,7 +1802,8 @@ public class MInOut extends X_M_InOut implements DocAction docsPostProcess.add(doc); } - public ArrayList getDocsPostProcess() { + @Override + public List getDocsPostProcess() { return docsPostProcess; } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 1d7a62c782..1c9f4ddc89 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -40,6 +40,7 @@ import org.compiere.print.MPrintFormat; import org.compiere.print.ReportEngine; import org.compiere.process.DocAction; import org.compiere.process.DocumentEngine; +import org.compiere.process.IDocsPostProcess; import org.compiere.process.ProcessInfo; import org.compiere.process.ServerProcessCtl; import org.compiere.util.CLogger; @@ -66,7 +67,7 @@ import org.eevolution.model.MPPProductBOMLine; * Modifications: Added RMA functionality (Ashley Ramdass) * Modifications: Generate DocNo^ instead of using a new number whan an invoice is reversed (Diego Ruiz-globalqss) */ -public class MInvoice extends X_C_Invoice implements DocAction +public class MInvoice extends X_C_Invoice implements DocAction, IDocsPostProcess { /** * @@ -2236,7 +2237,8 @@ public class MInvoice extends X_C_Invoice implements DocAction docsPostProcess.add(doc); } - public ArrayList getDocsPostProcess() { + @Override + public List getDocsPostProcess() { return docsPostProcess; } diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index b501045c14..76f6154f14 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -34,6 +34,7 @@ import org.adempiere.util.IProcessUI; import org.adempiere.util.PaymentUtil; import org.compiere.process.DocAction; import org.compiere.process.DocumentEngine; +import org.compiere.process.IDocsPostProcess; import org.compiere.process.ProcessCall; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; @@ -82,7 +83,7 @@ import org.compiere.util.ValueNamePair; * @version $Id: MPayment.java,v 1.4 2006/10/02 05:18:39 jjanke Exp $ */ public class MPayment extends X_C_Payment - implements DocAction, ProcessCall, PaymentInterface + implements DocAction, ProcessCall, PaymentInterface, IDocsPostProcess { /** * @@ -2162,7 +2163,8 @@ public class MPayment extends X_C_Payment docsPostProcess.add(doc); } - public ArrayList getDocsPostProcess() { + @Override + public List getDocsPostProcess() { return docsPostProcess; } diff --git a/org.adempiere.base/src/org/compiere/process/DocumentEngine.java b/org.adempiere.base/src/org/compiere/process/DocumentEngine.java index 2720a3dde7..c4aa5dad12 100644 --- a/org.adempiere.base/src/org/compiere/process/DocumentEngine.java +++ b/org.adempiere.base/src/org/compiere/process/DocumentEngine.java @@ -23,6 +23,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.Properties; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; @@ -328,15 +329,9 @@ public class DocumentEngine implements DocAction if (m_document != null && ok) { // PostProcess documents when invoice or inout (this is to postprocess the generated MatchPO and MatchInv if any) - ArrayList docsPostProcess = new ArrayList(); - if (m_document instanceof MInvoice || m_document instanceof MInOut || m_document instanceof MPayment) { - if (m_document instanceof MInvoice) { - docsPostProcess = ((MInvoice) m_document).getDocsPostProcess(); - } else if (m_document instanceof MInOut) { - docsPostProcess = ((MInOut) m_document).getDocsPostProcess(); - } else if (m_document instanceof MPayment) { - docsPostProcess = ((MPayment) m_document).getDocsPostProcess(); - } + List docsPostProcess = new ArrayList(); + if (m_document instanceof IDocsPostProcess) { + docsPostProcess = ((IDocsPostProcess) m_document).getDocsPostProcess(); } if (m_document instanceof PO && docsPostProcess.size() > 0) { // Process (this is to update the ProcessedOn flag with a timestamp after the original document) diff --git a/org.adempiere.base/src/org/compiere/process/IDocsPostProcess.java b/org.adempiere.base/src/org/compiere/process/IDocsPostProcess.java new file mode 100644 index 0000000000..ad19a894c8 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/process/IDocsPostProcess.java @@ -0,0 +1,42 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - hengsin * + **********************************************************************/ +package org.compiere.process; + +import java.util.List; + +import org.compiere.model.PO; + +/** + * + * @author hengsin + * + */ +public interface IDocsPostProcess { + /** + * + * @return List of doc to process after Complete + */ + public List getDocsPostProcess(); +} diff --git a/org.idempiere.test/src/org/idempiere/test/model/InvoiceCustomerTest.java b/org.idempiere.test/src/org/idempiere/test/model/InvoiceCustomerTest.java index 3f4e78e813..7a84aa7abb 100644 --- a/org.idempiere.test/src/org/idempiere/test/model/InvoiceCustomerTest.java +++ b/org.idempiere.test/src/org/idempiere/test/model/InvoiceCustomerTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.math.BigDecimal; import java.sql.Timestamp; -import java.util.ArrayList; +import java.util.List; import java.util.logging.LogRecord; import org.compiere.model.MBPartner; @@ -126,7 +126,7 @@ public class InvoiceCustomerTest extends AbstractTestCase { assertEquals(false, invoice.isPaid(), "Invoice isPaid() is not false"); assertTrue(payment1.isPosted(), "Payment not posted"); - ArrayList postProcessDocs = payment1.getDocsPostProcess(); + List postProcessDocs = payment1.getDocsPostProcess(); for(PO postProcessDoc : postProcessDocs) { assertTrue(postProcessDoc.get_ValueAsBoolean("Posted"), "Post Process Doc not posted: " + postProcessDoc); }