![](/img/trans.png)
[英]How To Restrict Pages or Models based on User/Group Permissions with CBVs?
[英]Restrict adding comments based on group permissions in Notebook - Odoo 14
我想知道這是否可以限制為基於我在應用程序中定義的組添加評論,因為我看到的唯一屬性是隱藏筆記本小部件,但這不是我需要的
<!-- 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 您可能有以下選項來解決該問題。
開發一個小的 function 檢查當前登錄的用戶訪問權限/組並返回 boolean 值。 根據 boolean 值,您可以在 Comment 字段上設置只讀屬性。
您可以在 Comment 字段中添加groups
屬性。 它只能由具有訪問權限/安全組的用戶訪問。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.