تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
6 الردود
9643 أدوات العرض

Is there an event triggered when a form is shown?

الصورة الرمزية
إهمال
أفضل إجابة

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.

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

الكاتب

I guess I need karma 20 to do that.

أفضل إجابة

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

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

 

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
نوفمبر 24
1672
1
سبتمبر 21
9450
1
يناير 24
17062
3
فبراير 16
6446
0
مارس 15
3327