diff --git a/base/src/org/compiere/wf/MWFActivity.java b/base/src/org/compiere/wf/MWFActivity.java index 79e68ca7fe..992627e8c5 100644 --- a/base/src/org/compiere/wf/MWFActivity.java +++ b/base/src/org/compiere/wf/MWFActivity.java @@ -709,17 +709,27 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable // Do Work /**** Trx Start ****/ boolean done = performWork(m_trx); - //begin vpj-cd e-evolution 03/08/2005 PostgreSQL + //begin vpj-cd e-evolution 03/08/2005 PostgreSQL // Reason: When is execute setWFState create a transaction for same table is generate a clicle Trx // is cause that PostgreSQL wait into transaction idle //setWFState (done ? StateEngine.STATE_Completed : StateEngine.STATE_Suspended); //end vpj-cd e-evolution 03/08/2005 PostgreSQL + /**** Trx End ****/ - m_trx.commit(true); - m_trx.close(); - m_trx = null; - //begin vpj-cd e-evolution 03/08/2005 PostgreSQL - //Reason: setWFState moved for the first trx be finished + // teo_sarca [ 1708835 ] + // Reason: if the commit fails the document should be put in Invalid state + try { + m_trx.commit(true); + m_trx.close(); + m_trx = null; + } catch (Exception e) { + // If we have a DocStatus, change it to Invalid, and throw the exception to the next level + if (m_docStatus != null) + m_docStatus = DocAction.STATUS_Invalid; + throw e; + } + //begin vpj-cd e-evolution 03/08/2005 PostgreSQL + //Reason: setWFState moved for the first trx be finished setWFState (done ? StateEngine.STATE_Completed : StateEngine.STATE_Suspended); //end vpj-cd e-evolution 03/08/2005 PostgreSQL if (m_postImmediate != null)