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

Is there a function that can be used to get and check the data every time a specified menu is loaded/opened?

I have 1 field in the appointment module (time). What I want is when I open the appointment menu, a function will try to get/check all the data in appointment, then later the time field will be filled in according to the code I have made. So every time I open the appointments menu, odoo will check the existing data, and the time field data can be updated.


@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
res = super(MyMenu, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
data = self.env['appointment.appointment'].search([])
for record in data:
 app = self.env['appointment.time'].search([('time1','<=',record.time),('time2','>=',record.time)], limit=1)
if duration:
record.time_final= app.name + "o'clock"
return res


I have tried the code above, but it only runs 1 time (when I restarted the odoo server).

아바타
취소
관련 게시물 답글 화면 활동
2
7월 19
8616
1
4월 15
4852
0
3월 15
3383
3
8월 24
1789
1
8월 22
7940