mirror of
https://github.com/bringout/oca-workflow-process.git
synced 2026-04-19 12:12:00 +02:00
Initial commit: OCA Workflow Process packages (456 packages)
This commit is contained in:
commit
d366e42934
18799 changed files with 1284507 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class ProjectTask(models.Model):
|
||||
_inherit = "project.task"
|
||||
|
||||
sprint_id = fields.Many2one(
|
||||
comodel_name="project.sprint",
|
||||
string="Sprint",
|
||||
tracking=True,
|
||||
domain="['|', ('project_id', '=', False), ('project_id', '=', project_id)]",
|
||||
)
|
||||
|
||||
sprint_state = fields.Selection(
|
||||
related="sprint_id.state", string="Sprint State", store=True
|
||||
)
|
||||
|
||||
@api.constrains("user_ids")
|
||||
def _check_user_ids(self):
|
||||
for task in self:
|
||||
if task.user_ids and task.sprint_id:
|
||||
if not task.user_ids <= task.sprint_id.user_ids:
|
||||
raise ValidationError(
|
||||
_("The assignees must be part of the sprint.")
|
||||
)
|
||||
|
||||
@api.onchange("sprint_id")
|
||||
def _onchange_sprint_id(self):
|
||||
self.user_ids = False
|
||||
Loading…
Add table
Add a link
Reference in a new issue