Odoo Help


What event is triggered when a form view is shown?

Ratmil Torres
on 8/26/14, 10:04 AM 1,896 views

Is there an event triggered when a form is shown?

Ben Olsen
On 8/26/14, 4:02 PM

From the base model code:

    def view_init(self, cr, uid, fields_list, context=None):
        """Override this method to do specific things when a view on the object is opened."""

So in any model, you should be able to override view_init, and put any custom code in there. You don't even need to call super(), because the base class's view_init doesn't do anything.

Thanks a lot.

Ratmil Torres
on 8/26/14, 4:09 PM

Please mark this answer as accepted if this is what you're looking for. Thanks!

Ben Olsen
on 8/26/14, 4:14 PM

I guess I need karma 20 to do that.

Ratmil Torres
on 8/26/14, 4:36 PM
On 6/16/16, 9:54 PM

Correct this is only triggered for create new and not for edit.

Ratmil Torres
On 2/25/16, 3:11 PM

I just tried that and the event is triggered when the form is shown to create a new object. I need it to be called when an object is edited, also when the form is closed.

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/26/14, 10:04 AM
Seen: 1896 times
Last updated: 6/16/16, 9:54 PM