Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3244 มุมมอง

I have a function which checks the dates and then calculates the arrivals and departures using the data. but there are two problems, the first one is that I need to do this an automatic function so the user doesn't need to click 'update' and I tried to solve this by using this code below:

@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
submenu=False):
res = super(HotelReservation, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar,
submenu=submenu)

self.expected_arrivals_departures()

return res

the only problem with this is that it runs 5 times when I need only 1 time to run my function.


Can someone please help me? 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

The field_view_get function is the function responsible to the render/parse the view and create the view architecture which has to be displayed to the user.  It is executed when you refresh the screen and load a model.

Are you sure about your function has to be called from here itself ? If not, let me know what exactly you need to do or on what condition the expected_arrivals_departures function has to be triggered ?


If it has to be triggered in particular time interval, you can use scheduled actions.

Thanks

อวตาร
ละทิ้ง
ผู้เขียน

i wanted the function to be run automatically when the model loads up so the data will be updated when shown but I think I will
Implement a “onchange” api. Thank you!

hiii,

How can i load the sale.order with compute function when i try with field_view_get it shows loading how can i load the sale order view without loading issue

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ธ.ค. 22
3693
How to make sign up menu in website? แก้ไขแล้ว
2
เม.ย. 20
4645
1
เม.ย. 20
3600
2
ก.ย. 19
9189
2
มิ.ย. 19
5643