Affects Version/s: 7.3.X, Master
We are trying to retrieve workflow tasks related to a specific asset, in this specific case it is a CommerceOrder.
We are so using the search method from the WorkflowTaskManager class, sending:
- commerceOrder.getModelClassName() as assetType
- commerceOrder.getCommerceOrderId() as assetPrimaryKeys
You can check this class for the source code
As results we were expecing to get only the tasks related to that specific CommerceOrder, while we are receiving all the task associated to CommerceOrders. Since we are using these results to show a button to proceed with the workflow we end up with multiple button (as many as the total workflow task related to orders) for each order.
For example when having 3 order with an active workflow, we see 3 times the approve/reject button for each order instead of just the one for that specific order.
We implemented a workaround for a customer (LPP-41347), where we filter the results by commerceOrderId after receiving them, but we would like to know if this is the expected behavior or if we should only get the results already filtered by assetPrimaryKeys.
Please see PTR-2506
Steps to reproduce (using Commerce):
- setup a commerce site using the minium accelerator for convinience
- go to channel setting and activate the "seller order acceptance workflow" (menu -> commerce -> store management channels -> [your channel] -> general -> orders) and save the new settings
- access minium site and go to account management
- create a new account, put the omni-admin as part of the account
- back to the catalog page, add some products to the cart
- submit the cart and checkout the order
- repeat the cart/checkout procedure so that you have at least 2-3 orders placed
- put some other products in the cart but don't submit it
- go to the pending order page
- in the order's details page the workflow buttons are duplicated (or better as many as the orders)
- same result if you access the order details from the adminUI (menu -> commerce -> order management orders -> click on an order to see the details)