allow workflow to be suspended until after commit of actual transaction
Description
Environment
Attachments
- 06 Dec 2021, 04:35 PM
- 06 Dec 2021, 04:35 PM
- 25 Feb 2020, 03:53 PM
relates to
Activity
Carlos Ruiz January 17, 2022 at 10:45 AM
opened new ticket at https://idempiere.atlassian.net/browse/IDEMPIERE-5157#icft=IDEMPIERE-5157
Carlos Ruiz December 31, 2021 at 9:13 AM
Sounds better to keep this ticket closed and open a new one for this new unsupported case.

Martin Schönbeck December 31, 2021 at 8:14 AM
when using more than one commit in a workflow doesn't work. At least sometimes.
Scenario:
doc complete on an order
next step: wait for commit
next step: create shipment (InOutGenerate)
next step: wait for commit
next step: create invoice (InvoiceGenerate)
the invoice isn't generated and after that trying to get an invoice number hangs. After removing the second wait for commit it works.
Carlos Ruiz December 6, 2021 at 5:03 PM
Pull Request 1034 is intended to solve the issue with Split Element = AND
The code to complete MWFProcess is in MWFProcess.checkActivities just taking into account the running activity, which is wrong for AND because there can be multiple ramifications of the workflow and the actual code is just taking into account the actual ramification to close the process.
So, the solution is to separate the code: MWFProcess.checkActivities is still running activities and triggering next, but at the end of processing activities (in MWorkflow, WWFActivity and WorkflowProcessor) is calling MWFProcess.checkCloseActivities to make the decision about setting up the process status.
I tested this with the failing case, which can be setup importing the !IDEMPIERE-4186-test-AND.zip!
It configures the workflow for Material Receipt as shown at the screenshot:
!WFEditor.png!
I also tested the normal cases:
completing a non-modified workflow → OK
completing Requisition workflow started by GardenUser - this tests User Choice (with positive and negative answer) and User Window for the last node to verify and confirm. GardenAdmin confirming/denying using Workflow Activities form
workflow configured to wait certain time and triggered by Workflow Processor
Carlos Ruiz December 6, 2021 at 3:48 PM
This is just working with Split Element = XOR
Not working when the node has Split Element = AND, because the WFProcess is marked as completed before the second split node is executed
Because jasperreports by default only have a look at committed transactions and because we didn't want to print uncommitted documents the workflow activity wait-sleep was enabled to wait until the next commit. It is started by using a timeout of -1
xref -> https://groups.google.com/d/msg/idempiere/h_287v-Z7RY/5wMEaID_AQAJ