Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
6 Trả lời
9664 Lượt xem

Is there an event triggered when a form is shown?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks a lot.

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

Tác giả

I guess I need karma 20 to do that.

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 24
1684
1
thg 9 21
9468
1
thg 1 24
17067
3
thg 2 16
6494
0
thg 3 15
3342