Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
3274 Ansichten

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? 

Avatar
Verwerfen
Beste Antwort

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

Avatar
Verwerfen
Autor

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

Verknüpfte Beiträge Antworten Ansichten Aktivität
3
Dez. 22
3708
2
Apr. 20
4653
1
Apr. 20
3605
2
Sept. 19
9199
2
Juni 19
5651