From d0e3514ba664a3c21a54e3e230d211f6a6afccd0 Mon Sep 17 00:00:00 2001 From: Dirk Niemeyer Date: Wed, 24 Aug 2011 09:42:29 -0500 Subject: [PATCH] Fixes IDEMPIERE-63 - Document number is updated again when document completed after reactivation --- .../src/org/compiere/model/MOrder.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index edd4001adc..6273275207 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -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); + } } }