This question has been flagged
3 Replies
6591 Views

I had some context values that needs to be passed to the function with function call, but I tried to use workflow to pass the control to the function.

When I used workflow, all the context value were not available in the function when checked i.e. context = {}.

Is there a way to pass context value through workflow??

Avatar
Discard

It's a big problem !!

Best Answer

Hi, 

I solved it in a tricky way , i used a global variable and give it the context value.

let say you have 2 functions F1 and F2 like : 

@api.multi
def F1(self):
global contex
            contex = self._context
self.signal_workflow('F2')
@api.multi def F2(self): print contex
In this way you can pass your argument you need.
Hope its answers the question Sir.
And vote if you find it usefull.
              

Avatar
Discard
Best Answer

Although it may not look reasonable to some of us there is actually no way to pass context. As of Odoo 7.0 the workflow should be based exclusively on the state of the document regardless of any value in the context (the context should not be passed). You can check a very old bug about that here https://bugs.launchpad.net/openobject-server/+bug/434266

Avatar
Discard