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

[V8] Confirm dialog in write function

By
Aurélien Rivet
on 7/13/16, 9:02 AM 186 views

Hi,

I want to perform some checking in the ORM write method and show a confirm dialog with yes/no choices to ask confirmation.

If the user click yes, then the record will be saved. Otherwise, the dialog would just be closed.

I tried using exception raising but I don't know how to get which button the user clicked. Moreover, raising an exception implies that the method execution stops which is not what I want.

I also tried by creating a wizard in order to have a custom confirm dialog. But to display that wizard, a dict populated with special values (such as the id of the wizard view) has to be returned. Obviously, I can't return that dict from ORM method such as write.

How can I achieve this ?

What is the best way to do that ?


0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 7/14/16, 2:25 AM

This is one among the other things in which Odoo is lacking, to my knowledge we don't have any option to ask for confirmation before proceeding.

Write method (ORM method) is not an ideal place to handle any kind of validation, unless you take care of necessary steps to ensure it doesn't stop the standard process of writing values into the database.

For instance, write method can be called/triggered by other dependent object, or it can be called during the computation of non-stored fields, and etc. So in these cases write method will be triggered systematically and if the custom validation stops from performing its basic action, then it will be a mess. 

So use write method in caution or try with some other alternate way to achieve your requirement.


Hi Thanks for your answer.

I have no problem about using an alternate way but I don't know how to do.

Aurélien Rivet
on 7/14/16, 12:10 PM

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: 7/13/16, 9:02 AM
Seen: 186 times
Last updated: 7/14/16, 2:25 AM