Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

[8.0] Is it possible to render a view in the middle of a method?

By
PY
on 3/17/16, 9:59 AM 241 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 !
0
PY
On 3/17/16, 11:03 AM

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/17/16, 9:59 AM
Seen: 241 times
Last updated: 3/17/16, 11:05 AM