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

Hi 

I want to hide kanban view's progress bar for some user. how to do this please if know the solution please let me know.

see my code

.py file 

class CRMLead(models.Model):
    _inherit = 'crm.lead'

    is_admin = fields.Boolean(compute="check_user_group")
    def check_user_group(self):
        self.is_admin = self.env['res.users'].has_group('base.user_admin')

.xml file

<xpath expr="//progressbar[@field='activity_state']" position="attributes">

<attribute name="attrs">{'invisible':[('is_admin','!=',True)]}</attribute>

</xpath>

This above code does not work for me

아바타
취소
베스트 답변

Hi,

Your code will hide for all users except admins but you need to add is_admin field to kanban view to be able to use it in domains.

<xpath expr="//field[@name='activity_state']" position="after">
<field name='is_admin' invisible="1"/>
</xpath>

If it's not work try the below please try the below: 

You can create a security group and it will be disabled for all users except root and admins and you can give access to users individually.  

<record id="view_progress_bar" model="res.groups">
<field name="name">View Progress bar</field>
<!-- Add super user and admin to group, you can delete the below line to hide for them as well --> 
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>

</record>


Then inherit view and add the below:

<xpath expr="//progressbar[@field='activity_state']" position="attributes">
<attribute name="groups">[YOUR_Module_Name].view_progress_bar</attribute>
</xpath>

Then and for each user you want to view the progress bar, you will enable developer mode then go Settings -> users -> open required user

Edit the user record and you will see at the bottom your create group with Checkbox named "View Progress bar" and you will check it to allow user to view progress bar.

Please up vote if this help.

아바타
취소
작성자

Hii @Waleed

as you say that [YOUR_Module_Name] here pass my module name but actually i don' t create any module i just inherited the crm.lead module so i can't understand what is pass there as a YOUR_Module_Name. can you say me what is pass there ?

YOUR_Module_Name means your your custom module name

작성자

But i don't made any custom module. i just inherited the crm.lead system module. so what i do ?

Any customization or inheritance should be done custom module. what is the main folder name which contain your python ,XMl,init and manifest files?

관련 게시물 답글 화면 활동
1
6월 23
3295
1
3월 16
5000
1
3월 15
5114
0
11월 19
3485
3
2월 18
9218