コンテンツへスキップ
メニュー
この質問にフラグが付けられました
5 返信
11499 ビュー

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 !

アバター
破棄
最善の回答

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.



アバター
破棄
著作者

I answered you below :)

最善の回答

I had the same problem as you

have you found a solution !!


アバター
破棄
著作者 最善の回答

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 !

アバター
破棄

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

関連投稿 返信 ビュー 活動
2
4月 24
1254
2
12月 20
9105
0
3月 15
3259
5
8月 23
12388
0
6月 19
4568