Skip to Content
Menu
This question has been flagged
1 Reply
2276 Views

I know how to render a view with a function, by returning a dictionnary containing the description of the function. But, I would like to render a view (a wizard form) to ask something to the user. Then, continue the method when the view is closed.

The reason I don't want to separate the rest in another function is that, then, someone with enough access rights might just call the second function, and the check performed by the wizard would not be done.

Is that even possible ?


The ideal function:

@api.multi
def dangerous_function(self):
# challenge for password
  [...]

# dangerous code starts here
  [...]

The not so ideal but easier to implement functions:

@api.multi
def challenge_password(self):
return [...] # a view that, on press OK, will call next function>

@api.multi
# dangerous code starts here
# is callable independently, let's say, from a server action: no check password in this case !
Avatar
Discard
Author Best Answer

Not that I know, but for the problem I face:

Ok, I'm stupid, or tired, or both. Here's the solution for this:

@api.multi
def challenge_password(self):
 return [...] # a view that, on press OK, will call next function

@api.multi
    # just check here the password that was entered in the previous form
# if no password is set, then abort
 # dangerous code starts here

Bonus: delete the record that holds the password right after the password check.

Avatar
Discard