IDEMPIERE-3965 Allocation posted with error when multi-currency and immediate accounting
This commit is contained in:
parent
d6120e2f80
commit
aa580a443b
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -83,8 +84,10 @@ import org.compiere.util.ValueNamePair;
|
||||||
public class MPayment extends X_C_Payment
|
public class MPayment extends X_C_Payment
|
||||||
implements DocAction, ProcessCall, PaymentInterface
|
implements DocAction, ProcessCall, PaymentInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
private static final long serialVersionUID = -7179638016937305380L;
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -6268462097642919346L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Payments Of BPartner
|
* Get Payments Of BPartner
|
||||||
|
@ -2111,6 +2114,16 @@ public class MPayment extends X_C_Payment
|
||||||
return DocAction.STATUS_Completed;
|
return DocAction.STATUS_Completed;
|
||||||
} // completeIt
|
} // completeIt
|
||||||
|
|
||||||
|
/* Save array of documents to process AFTER completing this one */
|
||||||
|
ArrayList<PO> docsPostProcess = new ArrayList<PO>();
|
||||||
|
|
||||||
|
protected void addDocsPostProcess(PO doc) {
|
||||||
|
docsPostProcess.add(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<PO> getDocsPostProcess() {
|
||||||
|
return docsPostProcess;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the definite document number after completed
|
* Set the definite document number after completed
|
||||||
|
@ -2289,6 +2302,7 @@ public class MPayment extends X_C_Payment
|
||||||
// added AdempiereException by zuhri
|
// added AdempiereException by zuhri
|
||||||
if (!alloc.processIt(DocAction.ACTION_Complete))
|
if (!alloc.processIt(DocAction.ACTION_Complete))
|
||||||
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedProcessingDocument") + " - " + alloc.getProcessMsg());
|
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedProcessingDocument") + " - " + alloc.getProcessMsg());
|
||||||
|
addDocsPostProcess(alloc);
|
||||||
// end added
|
// end added
|
||||||
m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo();
|
m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo();
|
||||||
return alloc.save(get_TrxName());
|
return alloc.save(get_TrxName());
|
||||||
|
@ -2324,6 +2338,7 @@ public class MPayment extends X_C_Payment
|
||||||
// added AdempiereException by zuhri
|
// added AdempiereException by zuhri
|
||||||
if (!alloc.processIt(DocAction.ACTION_Complete))
|
if (!alloc.processIt(DocAction.ACTION_Complete))
|
||||||
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedProcessingDocument") + " - " + alloc.getProcessMsg());
|
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedProcessingDocument") + " - " + alloc.getProcessMsg());
|
||||||
|
addDocsPostProcess(alloc);
|
||||||
// end added
|
// end added
|
||||||
alloc.saveEx(get_TrxName());
|
alloc.saveEx(get_TrxName());
|
||||||
m_justCreatedAllocInv = alloc;
|
m_justCreatedAllocInv = alloc;
|
||||||
|
@ -2418,10 +2433,12 @@ public class MPayment extends X_C_Payment
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// added Adempiere Exception by zuhri
|
// added Adempiere Exception by zuhri
|
||||||
if(alloc.processIt(DocAction.ACTION_Complete))
|
if (alloc.processIt(DocAction.ACTION_Complete)) {
|
||||||
|
addDocsPostProcess(alloc);
|
||||||
ok = alloc.save(get_TrxName());
|
ok = alloc.save(get_TrxName());
|
||||||
else
|
} else {
|
||||||
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedProcessingDocument") + " - " + alloc.getProcessMsg());
|
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedProcessingDocument") + " - " + alloc.getProcessMsg());
|
||||||
|
}
|
||||||
// end added by zuhri
|
// end added by zuhri
|
||||||
m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo();
|
m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo();
|
||||||
}
|
}
|
||||||
|
@ -2709,6 +2726,7 @@ public class MPayment extends X_C_Payment
|
||||||
// added AdempiereException by zuhri
|
// added AdempiereException by zuhri
|
||||||
if (!alloc.processIt(DocAction.ACTION_Complete))
|
if (!alloc.processIt(DocAction.ACTION_Complete))
|
||||||
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedProcessingDocument") + " - " + alloc.getProcessMsg());
|
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedProcessingDocument") + " - " + alloc.getProcessMsg());
|
||||||
|
addDocsPostProcess(alloc);
|
||||||
// end added
|
// end added
|
||||||
alloc.saveEx(get_TrxName());
|
alloc.saveEx(get_TrxName());
|
||||||
//
|
//
|
||||||
|
|
|
@ -323,12 +323,13 @@ public class DocumentEngine implements DocAction
|
||||||
{
|
{
|
||||||
// PostProcess documents when invoice or inout (this is to postprocess the generated MatchPO and MatchInv if any)
|
// PostProcess documents when invoice or inout (this is to postprocess the generated MatchPO and MatchInv if any)
|
||||||
ArrayList<PO> docsPostProcess = new ArrayList<PO>();
|
ArrayList<PO> docsPostProcess = new ArrayList<PO>();
|
||||||
if (m_document instanceof MInvoice || m_document instanceof MInOut) {
|
if (m_document instanceof MInvoice || m_document instanceof MInOut || m_document instanceof MPayment) {
|
||||||
if (m_document instanceof MInvoice) {
|
if (m_document instanceof MInvoice) {
|
||||||
docsPostProcess = ((MInvoice) m_document).getDocsPostProcess();
|
docsPostProcess = ((MInvoice) m_document).getDocsPostProcess();
|
||||||
}
|
} else if (m_document instanceof MInOut) {
|
||||||
if (m_document instanceof MInOut) {
|
|
||||||
docsPostProcess = ((MInOut) m_document).getDocsPostProcess();
|
docsPostProcess = ((MInOut) m_document).getDocsPostProcess();
|
||||||
|
} else if (m_document instanceof MPayment) {
|
||||||
|
docsPostProcess = ((MPayment) m_document).getDocsPostProcess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_document instanceof PO && docsPostProcess.size() > 0) {
|
if (m_document instanceof PO && docsPostProcess.size() > 0) {
|
||||||
|
|
Loading…
Reference in New Issue