-
-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tarteo/16.0-add-project_scrum-patch
Move task to separate file and make project.sprint.project_id optional
- Loading branch information
Showing
9 changed files
with
105 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import project_sprint | ||
from . import project | ||
from . import project_task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
track_visibility="onchange", | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="project_task_inherit_form_view" model="ir.ui.view"> | ||
<field name="name">project.task.inherit.form.view</field> | ||
<field name="model">project.task</field> | ||
<field name="inherit_id" ref="project.view_task_form2" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='project_id']" position="after"> | ||
<field name="sprint_id" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
<record id="project_task_inherit_tree_view" model="ir.ui.view"> | ||
<field name="name">project.task.inherit.tree.view</field> | ||
<field name="model">project.task</field> | ||
<field name="inherit_id" ref="project.view_task_tree2" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='project_id']" position="after"> | ||
<field name="sprint_id" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
<record id="project_task_inherit_search_view" model="ir.ui.view"> | ||
<field name="name">project.task.inherit.search.view</field> | ||
<field name="model">project.task</field> | ||
<field name="inherit_id" ref="project.view_task_search_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//group" position="before"> | ||
<separator /> | ||
<filter | ||
name="sprint_in_progress_task" | ||
string="Sprint In Progress" | ||
domain="[('sprint_state', '=', 'in_progress')]" | ||
/> | ||
</xpath> | ||
<xpath expr="//group" position="inside"> | ||
<filter | ||
name="sprint_id" | ||
string="Sprint" | ||
context="{'group_by':'sprint_id'}" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
<record id="view_task_timeline" model="ir.ui.view"> | ||
<field name="model">project.task</field> | ||
<field name="type">timeline</field> | ||
<field name="inherit_id" ref="project_timeline.project_task_timeline" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//timeline" position="attributes"> | ||
<attribute name="default_group_by">sprint_id</attribute> | ||
<attribute name="event_open_popup">False</attribute> | ||
<attribute name="dependency_arrows">False</attribute> | ||
</xpath> | ||
|
||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters