IDEMPIERE-2287 Overwrite Date on Complete - doesn't update dateacct / move call to setDefiniteDocumentNo to the beginning of completeIt (just after prepareIt)

This commit is contained in:
Carlos Ruiz 2014-12-18 12:28:43 -05:00
parent e875d72fb0
commit 0eb7daffcb
13 changed files with 51 additions and 50 deletions

View File

@ -131,8 +131,10 @@ implements DocAction
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -156,9 +158,6 @@ implements DocAction
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
setProcessed(true);
setDocAction(DOCACTION_Close);

View File

@ -194,8 +194,10 @@ implements DocAction
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -223,9 +225,6 @@ implements DocAction
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
setProcessed(true);
setDocAction(DOCACTION_Close);

View File

@ -1256,6 +1256,9 @@ public class MInOut extends X_M_InOut implements DocAction
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -1652,9 +1655,6 @@ public class MInOut extends X_M_InOut implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = info.toString();
setProcessed(true);
setDocAction(DOCACTION_Close);

View File

@ -390,6 +390,9 @@ public class MInventory extends X_M_Inventory implements DocAction
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -579,9 +582,6 @@ public class MInventory extends X_M_Inventory implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);
setDocAction(DOCACTION_Close);

View File

@ -1692,6 +1692,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -2086,9 +2089,6 @@ public class MInvoice extends X_C_Invoice implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// Counter Documents
MInvoice counter = createCounterDoc();
if (counter != null)
@ -2120,7 +2120,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
setDateInvoiced(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateInvoiced())) {
setDateAcct(getDateInvoiced());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocTypeTarget_ID(), getAD_Org_ID());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
}
}
if (dt.isOverwriteSeqOnComplete()) {

View File

@ -593,7 +593,10 @@ public class MJournal extends X_GL_Journal implements DocAction
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -610,9 +613,6 @@ public class MJournal extends X_GL_Journal implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);
setDocAction(DOCACTION_Close);

View File

@ -438,7 +438,10 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -494,9 +497,6 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);
setDocAction(DOCACTION_Close);

View File

@ -353,7 +353,10 @@ public class MMovement extends X_M_Movement implements DocAction
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -531,9 +534,6 @@ public class MMovement extends X_M_Movement implements DocAction
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);

View File

@ -1869,6 +1869,10 @@ public class MOrder extends X_C_Order implements DocAction
setProcessed(false);
return DocAction.STATUS_InProgress;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// Offers
if (MDocType.DOCSUBTYPESO_Proposal.equals(DocSubTypeSO)
|| MDocType.DOCSUBTYPESO_Quotation.equals(DocSubTypeSO))
@ -1882,8 +1886,6 @@ public class MOrder extends X_C_Order implements DocAction
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
setProcessed(true);
return DocAction.STATUS_Completed;
}
@ -1986,9 +1988,6 @@ public class MOrder extends X_C_Order implements DocAction
return DocAction.STATUS_Invalid;
}
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
setProcessed(true);
m_processMsg = info.toString();
@ -2130,7 +2129,7 @@ public class MOrder extends X_C_Order implements DocAction
setDateOrdered(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateOrdered())) {
setDateAcct(getDateOrdered());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocTypeTarget_ID(), getAD_Org_ID());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
}
}
}

View File

@ -1943,7 +1943,10 @@ public class MPayment extends X_C_Payment
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -2077,9 +2080,6 @@ public class MPayment extends X_C_Payment
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);

View File

@ -430,6 +430,9 @@ public class MRMA extends X_M_RMA implements DocAction
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -461,9 +464,6 @@ public class MRMA extends X_M_RMA implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);
setDocAction(DOCACTION_Close);

View File

@ -331,6 +331,9 @@ public class MRequisition extends X_M_Requisition implements DocAction
return status;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -348,9 +351,6 @@ public class MRequisition extends X_M_Requisition implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);
setDocAction(ACTION_Close);

View File

@ -216,6 +216,8 @@ public class DocActionTemplate extends PO implements DocAction
return status;
}
// setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -233,8 +235,6 @@ public class DocActionTemplate extends PO implements DocAction
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
// setDefiniteDocumentNo();
// setProcessed(true);
// setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed;
@ -248,6 +248,10 @@ public class DocActionTemplate extends PO implements DocAction
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) {
setDateInvoiced(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateInvoiced())) {
setDateAcct(getDateInvoiced());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
}
}
if (dt.isOverwriteSeqOnComplete()) {
String value = null;