简体   繁体   中英

Restrict adding comments based on group permissions in Notebook - Odoo 14

I was wondering if this is possible to restrict to adding comments based on groups i have defined in the application for what i have seen the only attribute is for hiding the notebook widget but that is not what i need

<!-- Set log notes invisible for specific user groups-->
    <record model="ir.ui.view" id="project_task_log_notes">
      <field name="name">project.task.log.notes</field>
      <field name="model">project.task</field>
      <field name="inherit_id" ref="project.view_task_form2"/>
      <field name="arch" type="xml">
        <xpath expr="div[@class='oe_chatter']" position="replace">
          <group name="log" class="oe_chatter" groups="rw_project.group_project_rm">
            <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>
          </group>
        </xpath>
        <xpath expr="//page[@name='description_page']" position="attributes">
            <attribute name="string">Comments</attribute>
        </xpath>
      </field>
    </record>

IMO you may have the following options to resolve the issue.

  1. Develop a small function which checks current logged user access rights/groups and return boolean value. Based on boolean value, you can set readonly attributes on the Comment field.

  2. You may add groups attributes on the Comment field. And it can be only accessed by users with access rights/security groups.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM