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

@ -132,6 +132,8 @@ 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)
@ -157,9 +159,6 @@ implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
setProcessed(true);
setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed;

View File

@ -195,6 +195,8 @@ 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)
@ -224,9 +226,6 @@ implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
setProcessed(true);
setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed;

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

@ -594,6 +594,9 @@ public class MJournal extends X_GL_Journal 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;
@ -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

@ -439,6 +439,9 @@ public class MJournalBatch extends X_GL_JournalBatch 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;
@ -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

@ -354,6 +354,9 @@ public class MMovement extends X_M_Movement 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;
@ -532,9 +535,6 @@ public class MMovement extends X_M_Movement implements DocAction
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);
setDocAction(DOCACTION_Close);

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;
}
@ -1987,9 +1989,6 @@ public class MOrder extends X_C_Order implements DocAction
}
}
// 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

@ -1944,6 +1944,9 @@ public class MPayment extends X_C_Payment
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;
@ -2078,9 +2081,6 @@ public class MPayment extends X_C_Payment
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);
setDocAction(DOCACTION_Close);

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;