Skip to Content
Menu
This question has been flagged
5 Replies
10218 Views

Hello ! 

I have to synchronize a list of records with a side server. I already have my loadMethod that updates odoo DB working but for now the only way i had to call it is to create a field that compute it. It's ugly and I need a "create record" that calls the method.

How can I do to make the method be called when the view is loaded so i can get rid of my "create record" and my useless "actualize compute field".

If it's not possible, can i, at least, call this method when Odoo server is launched ? (the records are not going to be changed a lot on the side server)

Thank you very much !

Avatar
Discard
Best Answer

Am not sure whether I follow your requirement,

Incase if you are trying to execute a method before creating a Record, then use "default_get()" method, which will be first method to execute for every New record creation.

Or

If you are trying to execute method when everytime view is loaded, then ensure Compute field is not stored to the database, Which means odoo will compute the value for this field every time you load a view, as the data is not stored. However if the compute field is stored to database, then it will be triggered only at the time of creation or update/writing to that record

Or

If you are trying to execute method, at launch of Odoo server, then use "__init__()" method in your Object to perform your task.



Avatar
Discard
Author

I answered you below :)

Best Answer

I had the same problem as you

have you found a solution !!


Avatar
Discard
Author Best Answer

Thank you for your answer
I'll try to precise it : I would like to generate a list of record (that doesn't exist in a first place) when the view is loaded.
So i created a method that calls create(vals) in a loop but i don't know how to call this method each time the view is loaded without calling it from an instance of the model.

Thank you again !

Avatar
Discard

I suppose your requirement could be partly achieved using View Objects.(i.e _auto=False). Please check.

Related Posts Replies Views Activity
2
Apr 24
366
2
Dec 20
7886
0
Mar 15
2451
5
Aug 23
11346
0
Jun 19
3907