Fixes IDEMPIERE-63 - Document number is updated again when document completed after reactivation

This commit is contained in:
Dirk Niemeyer 2011-08-24 09:42:29 -05:00
parent c252c4475c
commit d0e3514ba6
1 changed files with 10 additions and 4 deletions

View File

@ -1833,12 +1833,18 @@ public class MOrder extends X_C_Order implements DocAction
private void setDefiniteDocumentNo() {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) {
setDateOrdered(new Timestamp (System.currentTimeMillis()));
/* a42niem - BF IDEMPIERE-63 - check if document has been completed before */
if (this.getProcessedOn().compareTo(Env.ZERO) == 0) {
setDateOrdered(new Timestamp (System.currentTimeMillis()));
}
}
if (dt.isOverwriteSeqOnComplete()) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);
if (value != null)
setDocumentNo(value);
/* a42niem - BF IDEMPIERE-63 - check if document has been completed before */
if (this.getProcessedOn().compareTo(Env.ZERO) == 0) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);
if (value != null)
setDocumentNo(value);
}
}
}