콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
5 답글
11642 화면

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
1339
2
12월 20
9266
0
3월 15
3399
5
8월 23
12545
0
6월 19
4684