This question has been flagged

I created the module below to the project.task model.

The module appeared to work fine. However, we have a larger number of tasks which we created via import and which are subtasks to a larger controlling task. Assigned employees to these subtasks do not have read access to the parent task (are not followers) but can be assignees of the subtasks.

When trying to move the subtask between stages assignees get a read error on the milestonetype_id field. We figured out that this could be resolved if the assignee has reading permissions (is a follower) on the parent task.

Why is that? Why would the action on the subtask need to read values from the parent task?

Does the onchange function maybe also act on the parent task?


# -*- 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")

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")


Avatar
Discard
Author Best Answer

Apparently this is an innate behavior of odoo as permissions are observed from the parent task, too.

It wasn't an issue with my module.

Avatar
Discard