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.

1

What event is triggered when a form view is shown?

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

Is there an event triggered when a form is shown?

2
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."""
        pass

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
0
Ehtesham
On 6/16/16, 9:54 PM

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

0
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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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