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

how to Customize User Name display  on upper right corner in Odoo 16 using custom addons or studio . The idea is to display the role of the user like Manager , Billing etc

아바타
취소

the question if there are 10 roles for a user, than which role you want to display?

작성자

we may have preference for the role , in my case user will only have one role

작성자 베스트 답변

Thanks . Where should i load this file in custom module

아바타
취소
베스트 답변

Hi Shibi, 


You can try below solution:


  •  Add a role field with many2one/selection type on user or on partner level.
  • Change the display name on the right corner with xpath in the rendering template.


Thanks.


아바타
취소
작성자

I tried the xpath solution seems to be not working . Not sure if understand this "Add a role field with many2one/selection type on user or on partner level."

Hi Shibi,

Let me help you with the xpath:

<template id="show_email_on_login" inherit_id="portal.user_dropdown">
<xpath expr="//span[@t-if='_user_name']" position="replace">
<span t-if="_user_name" t-attf-class="#{_user_name_class}" t-esc="user_id.email[:23] + '...' if user_id.email and len(user_id.email) &gt; 25 else user_id.email"/>
</xpath>
</template>

With this xpath, I am able to show email instead of the Customer name, similarly you can relace your field on above xpath with email to show ROLE .
Thanks

Thanks.

관련 게시물 답글 화면 활동
2
6월 22
3818
1
9월 19
6248
1
4월 17
5608
3
3월 15
11421
1
3월 15
3650