如何解决如果用户无权访问父任务,则 Odoo 11 对子任务操作的读取权限错误
我编写了一个模块来添加里程碑类型。里程碑基于 Many2one 字段并存储在辅助表中。 一切似乎都很好,但现在我遇到了一个问题。如果用户想要编辑子任务(例如,在阶段之间移动),并且该用户对相应的父任务甚至父任务的父任务没有读取权限,我就会收到访问错误。
由于安全限制,无法完成请求的操作。请联系您的系统管理员。
(文档类型:将里程碑指示器添加到项目看板视图并允许任务中的各种里程碑类型,操作:读取)-(记录:[39],用户:5)
我不确定为什么子任务需要来自父任务的查询值。
我还是不太了解Odoo中的权限层,感谢所有指点。
# -*- coding: utf-8 -*-
from odoo import models,fields,api
class project_show_milestone(models.Model):
_inherit = 'project.task'
_description = 'Adds milestone indicator to project kanban view and allows for various milestone type in task'
milestonetype_id = fields.Many2one('project.task.milestonetype',string="Meilensteinklasse")
ms_color = fields.Char(related="milestonetype_id.ms_color")
ms_icon = fields.Html(related="milestonetype_id.ms_icon")
date_deadline = fields.Date(string='Deadline',index=True,copy=False,track_visibility="onchange")
@api.onchange('date_deadline')
def _set_msdate(self):
if self.milestonetype_id:
self.date_start = str(self.date_deadline) + ' 18:00:00'
self.date_end = str(self.date_deadline) + ' 18:00:00'
self.message_post(body="Frist wurde verändert",subject="Terminanpassung",sub_type="mt_note")
@api.onchange('milestonetype_id')
def _set_milestone(self):
if self.milestonetype_id:
self.is_milestone = True
else:
self.is_milestone = False
class project_task_milestonetypes(models.Model):
_name = 'project.task.milestonetype'
name = fields.Char(string="Bezeichnung")
description = fields.Char(string="Beschreibung")
ms_color = fields.Char(string="Kanbanfarbe")
ms_icon = fields.Html(string="MS",compute = '_create_icon',store = True)
@api.depends('ms_color')
def _create_icon(self):
for rec in self:
self.ms_icon = '<div id="mssymb" style="transform: rotate(45deg); width:12px; height:12px;background:' + str(rec.ms_color) + ';"></div>'
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。