This question has been flagged
3 Replies
5960 Views

Hi

I'd like to make notes on employees, that should not be visible by all employees, just be the manager and the employee himself.

I tried to extend the view, but the attributes seem not to work on the oe_chatter nore on message_ids.


This is the hr.employee.form

<div class="oe_chatter">          
    <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>   
    <field name="message_ids" widget="mail_thread" invisible="True"/>  
</div>

This is the extended view

<data>  
    <xpath expr="//field[@name='message_ids']" position="attributes">   
        <attribute name="attrs">{}</attribute>   
        <attribute name="groups">hr.group_hr_manager</attribute> 
    </xpath>
</data>

 

Still the oe_chatter is visible to all employees.

Any help is appreciated.



Avatar
Discard

Look into Display multiple form and tree view for same model: http://learnopenerp.blogspot.com/2017/12/display-multiple-form-and-tree-view-for.html

hope this will helps you.

Best Answer

Hi,

try to create 2 different form views: one with chatter, another without.

For the form without chatter do not locate chatter or replace it. For the form with chatter assign groups:

        <record id="view_employee_form_with_chatter" model="ir.ui.view">
            <field name="name">hr.employee.form</field>
            <field name="model">hr.employee</field>
            <field name="group_ids" eval="[(4,ref('hr.group_hr_manager'))]"/>
            <field name="inherit_id" ref="hr.view_employee_form"/>
            <field name="arch" type="xml">
            ... <-- Place a chatter after sheet -->    


For the example look at the module hr_timesheet, the view hr_department_view_kanban.

Groups and visibility in chatter do not work. Another option is to change the js widget



Avatar
Discard
Author Best Answer

Thank you very much Serish and Odoo Tools. Your tip helps me a lot. Now I understand how to achieve it.

Avatar
Discard