帮助

0

How to show chatter for a specific group of user in odoo15

< div class="oe_chatter">
< field
name="message_follower_ids"/>
< field
name="message_ids"/>
< /div>

This simple code show chatter information for all internal users. But I want to show it only for a group. How can I do this?


头像
丢弃
2答案
1
Avatar
Angelo
最佳答案

This is my solution:

You have to inherit the form view and specify the groups for which you want to hide chatter.

Example:

id="crm_lead_form_view_custom" model="ir.ui.view">
name="name">Form View for custom group
name="model">crm.lead
name="inherit_id" ref="crm.crm_lead_view_form"/>
name="groups_id" eval="[(6,0, (ref('module_name.custom_group'),))]"/>
name="arch" type="xml">
expr="//div[hasclass('oe_chatter')]" position="replace">
class="oe_chatter">





1备注
头像
丢弃
Avatar
Angelo
-

<record id="crm_lead_tree_view_button_salesman" model="ir.ui.view">
<field name="name">Form View for salesman</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form"/>
<field name="groups_id" eval="[(6,0, (ref('erp_plusinnovation.erp_salesman'),))]"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_chatter')]" position="replace">
<div class="oe_chatter">
</div>
</xpath>
</field>
</record>

1
Avatar
Kiran K
最佳答案
Hi Abdus Sattar Bhuiyan,

Inherit the form and specify the group you want to show chatter

<record id="res_bank_oe_chatter" model="ir.ui.view">
<field name="name">res.bank.chatter<field/>
<
field name="model">res.bank<field/>
<
field name="inherit_id" ref="base.view_res_bank_form"/>
<
field name="groups_id" eval="[(6, 0, [ref('your_module_name.your_group')])]"/> // Chatter will be visible only to this group
<field name="arch" type="xml">
<xpath expr="//sheet" position='after'>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<
field name="activity_ids" widget="mail_activity"/>
<
field name="message_ids" widget="mail_thread"/>
div>
xpath>
field>
record>

To Hide and make the chatter for an existing view,


// Remove Chatter For All Users
<record id="employee_oe_chatter_invisible" model="ir.ui.view">
<field name="name">hr.employee.chatterfield>
<
field name="model">hr.employeefield>
<
field name="inherit_id" ref="hr.view_employee_form"/>
<
field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_chatter')]" position="replace">
xpath>
field>
record>

// Visible To Custom Group
<record id="employee_oe_chatter_custom_group" model="ir.ui.view">
<field name="name">hr.employee.chatter.customfield>
<
field name="model">hr.employeefield>
<
field name="inherit_id" ref="hr.view_employee_form"/>
<
field name="groups_id" eval="[(6, 0, [ref('module_name.group')])]"/>
<
field name="arch" type="xml">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<
field name="activity_ids" widget="mail_activity"/>
<
field name="message_ids" widget="mail_thread"/>
div>
field>
record>




Hope it Helps,
Kiran K


头像
丢弃