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

Is it possible If yes, how should it do it ?

I would like to hide a button but it should be visible only for one user with very specific id or login/name.

I tried to use user_id but it gives me an error: Uncaught Error: Unknown field user_id in domain [["user_id","!=","Wario"]]

and I can't add user_id because is not available in stock module ;)

http://...../web/static/src/js/view_form.js:1697

Already checked this post:

https://www.odoo.com/forum/help-1/question/conditionally-display-or-hide-a-field-in-a-view-13042

Help a bit but not as much as I need ;)



아바타
취소

hi, to get the id of your current user you can use "self._uid" I think.

작성자

nope, it doesn't work ;(

작성자

Why everything is so complicated in Odoo ..... :)

베스트 답변

standard solution is to create a group and make this field seen only by this group, and adding to this group only the desired user.


Another way is to create a function field in the model of the view. By default the function field has 'uid' as one of the parameters passed to it. Compare the value of 'uid' with the specific id you need to check with and return true if it is the desired id.

the following will be the function body

res = {}
for i in ids:
     res[id] = True if uid==id else False
return res


아바타
취소
작성자

Hi Tarek, I did created a group in Odoo (Settings/Groups/Create) and added Superuser then in xml added groups="stock.group_stock_superuser" what technically should hide selected field andmake it wisible only for users in this group. Is it right ? or am I wrong ?

Hi Dr Obx,

This exactly will show the field tagged with superuser group to the superuser only and hide it from others, you have to upgrade the module and check the view

On Mon, Jan 4, 2016 at 1:13 PM, Dr Obx <robert.amberwitch@gmail.com> wrote:

Hi Tarek, I did created a group in Odoo (Settings/Groups/Create) and added Superuser then in xml added groups="stock.group_stock_superuser" what technically should hide selected field andmake it wisible only for users in this group. Is it right ? or am I wrong ?

Regards

Robert A.Lien



--
Tarek Ibrahim
ERP Developer
Cairo Branch
관련 게시물 답글 화면 활동
0
3월 16
3439
0
12월 15
4496
2
3월 15
4763
How to hide fields? 해결 완료
3
3월 15
28895
1
6월 23
3017