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

Hi everyone, I'm new to Odoo, and I'm working with v11. Currently I got a problem when I try to figure out "Contact tacker" module. It only show records that belongs to " Pieter Parker", so I had a look the filter in "hr_expense_views.xml" file and I find "[('employee_id.user_id', '=', uid)]",  can anyone explain the reason for using "XXX.user_id"?


please help me out

아바타
취소
베스트 답변

Hi,

Are you looking reason for why employee_id.user_id is used ?

In this case what they have done is that, for that user he can only view his own records, to achieve this the employee record and logged in user has to checked.


uid will hold the value of the current logged in user's id. Then it has to be compared with related user of the employee. All the employees is related to user, opening the employee form you can see a field named Related user.


The employee_id have the hr.employee record, from this record we can access the related user of an employee, so using the . operator, related user is accessed by employee_id.user_id and it is compared with uid, then for the records for which both matches will be shown.


If employee_id = uid , is given as filter , then employees id will get compared with the logged in users id.

Thanks

아바타
취소
작성자

Niyas, thank you for your answer. It helps a lot for me to understand the structure.

I guess the key is "Related User" in employee form, it is the way to link employee and user together (even they have different id in database), am I right? what about their email address, employee No. or name (unique) ?

And also you said that "All the employees is related to user " so what will happen if I keep that field empty, showing error or unable to view their expenses since they don't have any related user?

Thanks!

작성자 베스트 답변

Niyas, thank you for your answer, and sorry for can't making comment directly under your reply.

It helps a lot for me to understand the structure.

I guess the key is "Related User" in employee form, it is the way to link employee and user together (even they have different  id in database), am I right? what about their email address, employee No. or name (unique) ?

and also you said that "All the employees is related to user " so what will happen if I keep that field empty, showing error or unable to view their expenses since they don't have any related user?

아바타
취소
관련 게시물 답글 화면 활동
5
9월 20
13052
1
3월 15
5596
0
3월 15
4218
2
3월 15
7793
6
5월 24
71396