Skip to content

Commit

Permalink
[MIG] project_scrum: Migration to 13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando La Chica committed Nov 22, 2020
1 parent 58258cc commit a705256
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 84 deletions.
2 changes: 1 addition & 1 deletion project_scrum/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Project Scrum",
"summary": "Use Scrum Method to manage your project",
"version": "10.0.1.0.1",
"version": "13.0.1.0.0",
"category": "Project Management",
"author": "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project-agile",
Expand Down
10 changes: 1 addition & 9 deletions project_scrum/data/project_scrum_test_task_view.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.values" id="ps_make_test_task">
<field name="model_id" ref="model_project_scrum_sprint" />
<field name="name">Create tasks for test</field>
<field name="key2">client_action_multi</field>
<field name="key">action</field>
<field name="model">project.scrum.sprint</field>
</record>
<record model="ir.actions.server" id="ps_action_server_creat_test_task">
<field name="name">Create Tasks from Test Cases</field>
<field name="model_id" ref="model_project_scrum_sprint" />
<field name="state">code</field>
<field name="type">ir.actions.server</field>
<field name="code">self.test_task(cr, uid, object, pool)</field>
<field name="condition">True</field>
<field name="menu_ir_values_id" ref="ps_make_test_task" />
<field name="binding_model_id" ref="model_project_scrum_sprint" />
</record>
</odoo>
10 changes: 3 additions & 7 deletions project_scrum/models/project_scrum_meeting.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright <2017> <Tenovar Ltd>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo import _, fields, models


class ProjectScrumMeeting(models.Model):
_name = "project.scrum.meeting"
_description = "Project Scrum Daily Meetings"
_inherit = ["mail.thread", "ir.needaction_mixin"]
_inherit = ["mail.thread", "mail.activity.mixin"]

project_id = fields.Many2one(
comodel_name="project.project",
Expand Down Expand Up @@ -38,23 +38,19 @@ class ProjectScrumMeeting(models.Model):
)
company_id = fields.Many2one(related="project_id.analytic_account_id.company_id",)

@api.multi
def name_get(self):
result = []
for rec in self:
name = ""
if rec.project_id:
name = "{} - {} - {}".format(
rec.project_id.name,
rec.user_id_meeting.name,
rec.datetime_meeting,
rec.project_id.name, rec.user_id_meeting.name, rec.datetime_meeting,
)
else:
name = "{} - {}".format(rec.user_id_meeting.name, rec.datetime_meeting)
result.append((rec.id, name))
return result

@api.multi
def send_email(self):
self.ensure_one()
template = self.env.ref("project_scrum.email_template_id", False)
Expand Down
2 changes: 1 addition & 1 deletion project_scrum/models/project_scrum_sprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_current_sprint(self, project_id):
return sprint

def time_cal(self):
diff = fields.Date.from_string(self.date_stop) - fields.Date.from_string(
diff = fields.Date.to_date(self.date_stop) - fields.Date.to_date(
self.date_start
)
if diff.days <= 0:
Expand Down
4 changes: 2 additions & 2 deletions project_scrum/models/project_scrum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class ProjectScrumTest(models.Model):

def _resolve_project_id_from_context(self):
context = self.env.context
if type(context.get("default_project_id")) in (int, long):
if type(context.get("default_project_id")) in (int, int):
return context["default_project_id"]
if isinstance(context.get("default_project_id"), basestring):
if isinstance(context.get("default_project_id"), str):
project_name = context["default_project_id"]
project_ids = self.env["project.project"].name_search(name=project_name)
if len(project_ids) == 1:
Expand Down
7 changes: 3 additions & 4 deletions project_scrum/models/project_scrum_us.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ProjectScrumUs(models.Model):
_name = "project.scrum.us"
_description = "Project Scrum Use Stories"
_order = "reference"
_inherit = ["mail.thread", "ir.needaction_mixin"]
_inherit = ["mail.thread", "mail.activity.mixin"]

@api.model
def create(self, vals):
Expand Down Expand Up @@ -37,7 +37,6 @@ def _get_kano_field(self):
project_id = fields.Many2one(
comodel_name="project.project",
string="Project",
ondelete="set null",
index=True,
track_visibility="onchange",
change_default=True,
Expand Down Expand Up @@ -95,9 +94,9 @@ def _resolve_project_id_from_context(self):
"""
context = self.env.context
project_project_model = self.env["project.project"]
if type(context.get("default_project_id")) in (int, long):
if type(context.get("default_project_id")) in (int, int):
return context["default_project_id"]
if isinstance(context.get("default_project_id"), basestring):
if isinstance(context.get("default_project_id"), str):
project_name = context["default_project_id"]
project_ids = project_project_model.with_context(context)
project_ids = project_ids.name_search(project_name, operator="=")
Expand Down
1 change: 0 additions & 1 deletion project_scrum/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def _read_group_us_id(self, present_ids, domain, **kwargs):
else:
return [], None

@api.multi
def get_formview_id(self):
if all(self.mapped("use_scrum")):
return self.env.ref("project_scrum.view_ps_sprint_task_form2").id
Expand Down
4 changes: 4 additions & 0 deletions project_scrum/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Mohamed Habib Challouf <[email protected]>
* Samir Guesmi <[email protected]>
* George Daramouskas <[email protected]>
* Fernando La Chica <[email protected]>
4 changes: 4 additions & 0 deletions project_scrum/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Organize your tasks with the Scrum and Sprint methodology.

*Create Sprints to manage your task deadlines*
*Manage multiple sprint durations with the possibility of creating different Scrum Teams*
11 changes: 11 additions & 0 deletions project_scrum/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This module implements all concepts defined by the scrum project management
methodology for IT companies:

- Project with sprints, product owner, scrum master
- Sprints with reviews, daily meetings, feedbacks
- Product backlog
- Sprint backlog

The scrum projects and tasks inherit from the real projects and tasks,
so you can continue working on normal tasks that will also include tasks from
scrum projects.
58 changes: 29 additions & 29 deletions project_scrum/tests/test_project_scrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _test_create(self):
mail_alias = self.env["mail.alias"].create(
{
"alias_model_id": self.env["ir.model"]
.search([("model", "=", "res.users"),])
.search([("model", "=", "res.users")])
.id,
"alias_defaults": {},
"alias_contact": "everyone",
Expand Down Expand Up @@ -126,7 +126,7 @@ def _test_create(self):

def _test_get_formview_id(self):
self.project_task.write({"project_id": self.project_project.id})
self.assertEquals(
self.assertEqual(
self.project_task.get_formview_id(),
self.env.ref("project_scrum.view_ps_sprint_task_form2").id,
)
Expand All @@ -141,68 +141,68 @@ def _test_get_formview_id(self):

def _test_read(self):
_logger.debug("Testing read")
for key in self.project_project_vals.keys():
for key in list(self.project_project_vals.keys()):
attr = getattr(self.project_project, key)
if issubclass(type(attr), models.Model):
attr = attr.id
self.assertEquals(
self.assertEqual(
attr, self.project_project_vals[key],
)
for key in self.project_scrum_actors_vals.keys():
for key in list(self.project_scrum_actors_vals.keys()):
attr = getattr(self.project_scrum_actors, key)
if issubclass(type(attr), models.Model):
attr = attr.id
self.assertEquals(
self.assertEqual(
attr, self.project_scrum_actors_vals[key],
)
for key in filter(
lambda x: x not in ["message_follower_ids", "name"],
self.project_scrum_meeting_vals.keys(),
list(self.project_scrum_meeting_vals.keys()),
):
attr = getattr(self.project_scrum_meeting, key)
if issubclass(type(attr), models.Model):
attr = attr.id
self.assertEquals(
self.assertEqual(
attr, self.project_scrum_meeting_vals[key],
)
for key in self.project_scrum_sprint_vals.keys():
for key in list(self.project_scrum_sprint_vals.keys()):
attr = getattr(self.project_scrum_sprint, key)
if issubclass(type(attr), models.Model):
attr = attr.id
self.assertEquals(
self.assertEqual(
attr, self.project_scrum_sprint_vals[key],
)
for key in self.project_scrum_test_vals.keys():
for key in list(self.project_scrum_test_vals.keys()):
attr = getattr(self.project_scrum_sprint, key)
if issubclass(type(attr), models.Model):
attr = attr.id
self.assertEquals(
self.assertEqual(
attr, self.project_scrum_test_vals[key],
)
for key in filter(
lambda x: x not in ["message_follower_ids"],
self.project_scrum_us_vals.keys(),
list(self.project_scrum_us_vals.keys()),
):
attr = getattr(self.project_scrum_us, key)
if issubclass(type(attr), models.Model):
attr = attr.id
self.assertEquals(
self.assertEqual(
attr, self.project_scrum_us_vals[key],
)
for key in filter(
lambda x: x not in ["message_follower_ids", "code"],
self.project_task_vals.keys(),
list(self.project_task_vals.keys()),
):
attr = getattr(self.project_task, key)
if issubclass(type(attr), models.Model):
attr = attr.id
self.assertEquals(
self.assertEqual(
attr, self.project_task_vals[key],
)

def _test_assertions(self):
_logger.debug("Testing assertions")
self.assertEquals(
self.assertEqual(
self.project_scrum_meeting.name_get()[0][1],
"%s - %s - %s"
% (
Expand All @@ -211,11 +211,11 @@ def _test_assertions(self):
self.project_scrum_meeting.datetime_meeting,
),
)
self.assertEquals(self.project_scrum_sprint.task_count, 1)
self.assertEquals(self.project_project.sprint_count, 1)
self.assertEquals(self.project_project.user_story_count, 1)
self.assertEquals(self.project_project.meeting_count, 1)
self.assertEquals(self.project_project.test_case_count, 1)
self.assertEqual(self.project_scrum_sprint.task_count, 1)
self.assertEqual(self.project_project.sprint_count, 1)
self.assertEqual(self.project_project.user_story_count, 1)
self.assertEqual(self.project_project.meeting_count, 1)
self.assertEqual(self.project_project.test_case_count, 1)

def _test_write(self):
_logger.debug("Testing write")
Expand All @@ -234,10 +234,10 @@ def _test_write(self):

def _test_unlink(self):
_logger.debug("Testing unlinks")
self.assertEquals(self.project_scrum_actors.unlink(), True)
self.assertEquals(self.project_scrum_meeting.unlink(), True)
self.assertEquals(self.project_scrum_sprint.unlink(), True)
self.assertEquals(self.project_scrum_test.unlink(), True)
self.assertEquals(self.project_scrum_us.unlink(), True)
self.assertEquals(self.project_task.unlink(), True)
self.assertEquals(self.project_project.unlink(), True)
self.assertEqual(self.project_scrum_actors.unlink(), True)
self.assertEqual(self.project_scrum_meeting.unlink(), True)
self.assertEqual(self.project_scrum_sprint.unlink(), True)
self.assertEqual(self.project_scrum_test.unlink(), True)
self.assertEqual(self.project_scrum_us.unlink(), True)
self.assertEqual(self.project_task.unlink(), True)
self.assertEqual(self.project_project.unlink(), True)
11 changes: 7 additions & 4 deletions project_scrum/views/project_project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project" />
<field name="arch" type="xml">
<field name="use_tasks" position="before">
<group name="extra_settings" position="inside">
<field name="use_scrum" class="oe_inline" />
<label for="use_scrum" string="Use Scrum" />
</field>
</group>
</field>
</record>
<record id="act_project_tasks" model="ir.actions.act_window">
Expand Down Expand Up @@ -68,6 +68,7 @@
type="action"
icon="fa-files-o"
name="%(action_ps_us_current)d"
string="User stories"
>
<field name="user_story_count" widget="statinfo" />
</button>
Expand All @@ -76,6 +77,7 @@
type="action"
icon="fa-tasks"
name="%(action_ps_sprint_current)d"
string="Sprint"
>
<field name="sprint_count" widget="statinfo" />
</button>
Expand All @@ -84,6 +86,7 @@
type="action"
icon="fa-files-o"
name="%(action_ps_tc_current)d"
string="Tests cases"
>
<field name="test_case_count" widget="statinfo" />
</button>
Expand All @@ -92,6 +95,7 @@
type="action"
icon="fa-files-o"
name="%(action_ps_meeting_current)d"
string="Meetings"
>
<field name="meeting_count" widget="statinfo" />
</button>
Expand Down Expand Up @@ -126,7 +130,7 @@
<field name="use_scrum" />
<field name="description" />
</field>
<xpath expr="//div[@class='o_kanban_primary_left']" position='after'>
<xpath expr="//div[hasclass('o_kanban_primary_left')]" position='after'>
<a t-if="record.description.raw_value">
<h2>
<span class="o_label">Project Description</span>
Expand Down Expand Up @@ -208,7 +212,6 @@
<record id="action_show_scrum_projects" model="ir.actions.act_window">
<field name="name">Scrum Projects</field>
<field name="res_model">project.project</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,form</field>
<field name="search_view_id" ref="project.view_project_project_filter" />
<field name="context">{'default_use_scrum': True}</field>
Expand Down
12 changes: 7 additions & 5 deletions project_scrum/views/project_scrum_meeting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,28 @@
<group expand="0" string="Group By...">
<filter
string="Project"
name="project"
domain="[]"
context="{'group_by':'project_id'}"
/>
<separator orientation="vertical" />
<separator />
<filter
string="Sprint"
name="sprint"
domain="[]"
context="{'group_by':'sprint_id'}"
/>
<separator orientation="vertical" />
<separator />
<filter
string="Date"
name="date"
domain="[]"
context="{'group_by':'datetime_meeting'}"
/>
<separator orientation="vertical" />
<separator />
<filter
string="Name"
name="name"
domain="[]"
context="{'group_by':'user_id_meeting'}"
/>
Expand All @@ -117,7 +121,6 @@
<record id="action_ps_meeting_all" model="ir.actions.act_window">
<field name="name">Meetings</field>
<field name="res_model">project.scrum.meeting</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="view_id" ref="view_ps_meeting_calendar" />
<field name="context">{"search_default_current": 1}</field>
Expand All @@ -127,7 +130,6 @@
<record id="action_ps_meeting_current" model="ir.actions.act_window">
<field name="name">Meetings</field>
<field name="res_model">project.scrum.meeting</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="view_id" ref="view_ps_meeting_calendar" />
<field name="context">
Expand Down
Loading

0 comments on commit a705256

Please sign in to comment.