This question has been flagged
2 Replies
3221 Views

Hi everyone,

I use a workflow and when I am in a particular state, I want to go back to the initial state of the workflow and reiterate the workflow steps but when I go back to the initial state, my workflow does nothing.

can someone help me please 



Avatar
Discard
Best Answer

You could do it like this for Odoo v10:

records = self.env['your_model'].browse(ids)
records.delete_workflow()
records.create_workflow()
records.signal_workflow('signal1')
records.signal_workflow('signal2')
records.signal_workflow('signaln')

Hope this helps

Avatar
Discard
Author

Axel,

In which case we use signal_workflow('signal1') ?

signal_workflow is the way the workflow could trigger transitions by code, in the workflow definition you could see that activity states are tagged by a signal name and the transitions define the signal connector from an activity state to another

check that you marked as accepted your answer wish is incomplete related to the question and just a part of mine. That could confuse others users in the future

Author

Oh yes of course :p

thank you

Author Best Answer

Thank you so so so much ! 

I change a little your code, it's work now :)

self.delete_workflow()
self.create_workflow()
Avatar
Discard

it's the same, self in your case is the recordset that I put as records