diff --git a/base/src/org/adempiere/util/ProcessUtil.java b/base/src/org/adempiere/util/ProcessUtil.java index be719a71f0..2b0224ff45 100644 --- a/base/src/org/adempiere/util/ProcessUtil.java +++ b/base/src/org/adempiere/util/ProcessUtil.java @@ -249,9 +249,10 @@ public final class ProcessUtil { MWorkflow wf = MWorkflow.get (ctx, AD_Workflow_ID); MWFProcess wfProcess = null; if (pi.isBatch()) - wfProcess = wf.start(pi, null); // may return null - else + wfProcess = wf.start(pi, pi.getTransactionName()); // may return null + else { wfProcess = wf.startWait(pi); // may return null + } log.fine(pi.toString()); return wfProcess; } diff --git a/base/src/org/compiere/wf/MWFActivity.java b/base/src/org/compiere/wf/MWFActivity.java index 87418a96c0..ffdc1ff53f 100644 --- a/base/src/org/compiere/wf/MWFActivity.java +++ b/base/src/org/compiere/wf/MWFActivity.java @@ -371,7 +371,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable */ public PO getPO() { - return getPO(null); + return getPO(get_TrxName() != null ? Trx.get(get_TrxName(), false) : null); } // getPO /** @@ -381,7 +381,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable public int getPO_AD_Client_ID() { if (m_po == null) - getPO(null); + getPO(get_TrxName() != null ? Trx.get(get_TrxName(), false) : null); if (m_po != null) return m_po.getAD_Client_ID(); return 0; diff --git a/base/src/org/compiere/wf/MWorkflow.java b/base/src/org/compiere/wf/MWorkflow.java index 09402af624..f89fef5f93 100644 --- a/base/src/org/compiere/wf/MWorkflow.java +++ b/base/src/org/compiere/wf/MWorkflow.java @@ -710,7 +710,7 @@ public class MWorkflow extends X_AD_Workflow final int SLEEP = 500; // 1/2 sec final int MAXLOOPS = 30; // 15 sec // - MWFProcess process = start(pi, null); + MWFProcess process = start(pi, pi.getTransactionName()); if (process == null) return null; Thread.yield(); diff --git a/client/src/org/compiere/apps/ProcessCtl.java b/client/src/org/compiere/apps/ProcessCtl.java index 945d62f96c..995fecb8e6 100644 --- a/client/src/org/compiere/apps/ProcessCtl.java +++ b/client/src/org/compiere/apps/ProcessCtl.java @@ -571,6 +571,8 @@ public class ProcessCtl implements Runnable // Run locally if (!started && !m_IsServerProcess) { + if (m_trx != null) + m_pi.setTransactionName(m_trx.getTrxName()); MWFProcess wfProcess = ProcessUtil.startWorkFlow(Env.getCtx(), m_pi, AD_Workflow_ID); started = wfProcess != null; }