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

I'm working on customizing the mail.Chatter template in Odoo 17 to hide specific buttons, such as "Send Message" and "Log Note," in certain scenarios. I've tried using XML inheritance and XPath to modify the mail.Chatter template in my module, as follows:


<t t-name="akf.child.mail.Chatter" t-inherit="mail.Chatter">

    <xpath expr="//button[contains(@class, 'o-mail-Chatter-sendMessage')]" position="attributes">

        <attribute name="t-if">false</attribute>

    </xpath>

</t>


However, when I load my module, I get an error indicating that the template name is missing or that the inheritance is incorrect.

Has anyone successfully customized mail.Chatter in Odoo 17 to hide elements like these buttons? What would be the recommended approach, and is there a better way to control the visibility of buttons in mail.Chatter?


아바타
취소

Enhance your Odoo mail chatter experience by dynamically controlling the visibility of key buttons based on user preferences.
With this app, administrators can configure visibility settings for the most commonly used buttons in the chatter interface, such as "Send Message", "Log Note", "Activities", and more. Tailor the interface to individual users or specific models, ensuring a streamlined, role-based user experience.

https://apps.odoo.com/apps/modules/17.0/mh_hide_chatter_view_buttons

베스트 답변

espere

아바타
취소
베스트 답변

Hi,

Try this:


<t t-inherit="mail.Chatter" t-inherit-mode="extension">

<xpath expr="//button[hasclass('o-mail-Chatter-sendMessage')]"

position="replace">

<t t-if="">// Add your condition

<button t-if="props.hasMessageList"

class="o-mail-Chatter-sendMessage btn text-nowrap me-1"

t-att-class="{

'btn-primary': state.composerType !== 'note',

'btn-secondary': state.composerType === 'note',

'active': state.composerType === 'message',

'my-2': !props.compactHeight

}"

t-att-disabled="!state.thread.hasWriteAccess and !(state.thread.hasReadAccess and state.thread.canPostOnReadonly) and props.threadId"

data-hotkey="m"

t-on-click="() => this.toggleComposer('message')">

Send message

</button>

</t>

</xpath>


Hope it helps

아바타
취소