javrasya / django-river

Django workflow library that supports on the fly changes ⛵
BSD 3-Clause "New" or "Revised" License
741 stars 105 forks source link

[Help]A workflow path state tranform error #162

Closed AngelLiang closed 4 years ago

AngelLiang commented 4 years ago

Hello, thank you for your project, it's a great project and I very like it. When I use it, I meet some problem.

I make a workflow path as follow:

图片

when I walk the path: draft -> issued -> received -> closed (order 3) It's right and that's what I expected.

When I walk this path: draft -> issued -> part received -> received -> closed. the actual path is this :draft -> issued -> part received -> received (order 2).

图片

I expect that I walk the path is this: draft -> issued -> part received -> received -> closed. But it seems finish at received state. It can't tranform from received state to closed state. I very strange for it.

Can someone help me? Thank you.

javrasya commented 4 years ago

Sorry for late response @AngelLiang , Let me test this flow today and get back to you.

javrasya commented 4 years ago

Hi @AngelLiang , there was a bug in django-river. The part which was canceling all impossible future transitions was misfunctioning. PR #168 should fix your problem when it is released.

Keep in mind that the bug has turned the Closed transition of your workflow to CANCELLED. So the workflow objects that have been created before this bug will still not be able to be closed. But those objects that are created after the patch will just be fine. If you want to make your previous objects work as well, you can do a manual operation that is changing the status of Transition and TransitionApproval objects in your DB to be PENDING, so they can transit to the CLOSED state.

I have also referred to your workflow in the feature test in the PR to be able to reproduce the bug, so hope you don't mind :-)

javrasya commented 4 years ago

The changes have been published in the django-river version 3.2.2 @AngelLiang . Please upgrade django-river version to be that one and let me know if your problem is still in place. Feel free to create a new ticket if so.