From a705256f98f22d847456ead6c21c85adeef87410 Mon Sep 17 00:00:00 2001 From: Fernando La Chica Date: Sun, 22 Nov 2020 18:22:01 +0100 Subject: [PATCH] [MIG] project_scrum: Migration to 13.0 --- project_scrum/__manifest__.py | 2 +- .../data/project_scrum_test_task_view.xml | 10 +--- project_scrum/models/project_scrum_meeting.py | 10 +--- project_scrum/models/project_scrum_sprint.py | 2 +- project_scrum/models/project_scrum_test.py | 4 +- project_scrum/models/project_scrum_us.py | 7 +-- project_scrum/models/project_task.py | 1 - project_scrum/readme/CONTRIBUTORS.rst | 4 ++ project_scrum/readme/DESCRIPTION.rst | 4 ++ project_scrum/readme/USAGE.rst | 11 ++++ project_scrum/tests/test_project_scrum.py | 58 +++++++++---------- project_scrum/views/project_project.xml | 11 ++-- project_scrum/views/project_scrum_meeting.xml | 12 ++-- project_scrum/views/project_scrum_sprint.xml | 34 ++++++++--- project_scrum/views/project_scrum_test.xml | 22 +++++-- project_scrum/views/project_scrum_us.xml | 10 ++-- project_scrum/views/project_task.xml | 3 - setup/.setuptools-odoo-make-default-ignore | 2 + setup/README | 2 + setup/project_scrum/odoo/addons/project_scrum | 1 + setup/project_scrum/setup.py | 6 ++ 21 files changed, 132 insertions(+), 84 deletions(-) create mode 100644 project_scrum/readme/CONTRIBUTORS.rst create mode 100644 project_scrum/readme/DESCRIPTION.rst create mode 100644 project_scrum/readme/USAGE.rst create mode 100644 setup/.setuptools-odoo-make-default-ignore create mode 100644 setup/README create mode 120000 setup/project_scrum/odoo/addons/project_scrum create mode 100644 setup/project_scrum/setup.py diff --git a/project_scrum/__manifest__.py b/project_scrum/__manifest__.py index 8a38dc5..d2b6112 100644 --- a/project_scrum/__manifest__.py +++ b/project_scrum/__manifest__.py @@ -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", diff --git a/project_scrum/data/project_scrum_test_task_view.xml b/project_scrum/data/project_scrum_test_task_view.xml index b984b98..02fb836 100644 --- a/project_scrum/data/project_scrum_test_task_view.xml +++ b/project_scrum/data/project_scrum_test_task_view.xml @@ -1,19 +1,11 @@ - - - Create tasks for test - client_action_multi - action - project.scrum.sprint - Create Tasks from Test Cases code ir.actions.server self.test_task(cr, uid, object, pool) - True - + diff --git a/project_scrum/models/project_scrum_meeting.py b/project_scrum/models/project_scrum_meeting.py index e1f5a38..e71f6a3 100644 --- a/project_scrum/models/project_scrum_meeting.py +++ b/project_scrum/models/project_scrum_meeting.py @@ -1,12 +1,12 @@ # Copyright <2017> # 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", @@ -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) diff --git a/project_scrum/models/project_scrum_sprint.py b/project_scrum/models/project_scrum_sprint.py index 6418724..0b974c6 100644 --- a/project_scrum/models/project_scrum_sprint.py +++ b/project_scrum/models/project_scrum_sprint.py @@ -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: diff --git a/project_scrum/models/project_scrum_test.py b/project_scrum/models/project_scrum_test.py index ac87b80..181becc 100644 --- a/project_scrum/models/project_scrum_test.py +++ b/project_scrum/models/project_scrum_test.py @@ -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: diff --git a/project_scrum/models/project_scrum_us.py b/project_scrum/models/project_scrum_us.py index 624c280..b389f2c 100644 --- a/project_scrum/models/project_scrum_us.py +++ b/project_scrum/models/project_scrum_us.py @@ -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): @@ -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, @@ -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="=") diff --git a/project_scrum/models/project_task.py b/project_scrum/models/project_task.py index 27ee410..c773cb0 100644 --- a/project_scrum/models/project_task.py +++ b/project_scrum/models/project_task.py @@ -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 diff --git a/project_scrum/readme/CONTRIBUTORS.rst b/project_scrum/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..3dbd697 --- /dev/null +++ b/project_scrum/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Mohamed Habib Challouf +* Samir Guesmi +* George Daramouskas +* Fernando La Chica diff --git a/project_scrum/readme/DESCRIPTION.rst b/project_scrum/readme/DESCRIPTION.rst new file mode 100644 index 0000000..9fb2747 --- /dev/null +++ b/project_scrum/readme/DESCRIPTION.rst @@ -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* diff --git a/project_scrum/readme/USAGE.rst b/project_scrum/readme/USAGE.rst new file mode 100644 index 0000000..6e7f95e --- /dev/null +++ b/project_scrum/readme/USAGE.rst @@ -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. diff --git a/project_scrum/tests/test_project_scrum.py b/project_scrum/tests/test_project_scrum.py index 71a697c..55e8487 100644 --- a/project_scrum/tests/test_project_scrum.py +++ b/project_scrum/tests/test_project_scrum.py @@ -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", @@ -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, ) @@ -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" % ( @@ -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") @@ -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) diff --git a/project_scrum/views/project_project.xml b/project_scrum/views/project_project.xml index 509f60b..c622aac 100644 --- a/project_scrum/views/project_project.xml +++ b/project_scrum/views/project_project.xml @@ -20,10 +20,10 @@ project.project - + + @@ -68,6 +68,7 @@ type="action" icon="fa-files-o" name="%(action_ps_us_current)d" + string="User stories" > @@ -76,6 +77,7 @@ type="action" icon="fa-tasks" name="%(action_ps_sprint_current)d" + string="Sprint" > @@ -84,6 +86,7 @@ type="action" icon="fa-files-o" name="%(action_ps_tc_current)d" + string="Tests cases" > @@ -92,6 +95,7 @@ type="action" icon="fa-files-o" name="%(action_ps_meeting_current)d" + string="Meetings" > @@ -126,7 +130,7 @@ - +

Project Description @@ -208,7 +212,6 @@ Scrum Projects project.project - form kanban,form {'default_use_scrum': True} diff --git a/project_scrum/views/project_scrum_meeting.xml b/project_scrum/views/project_scrum_meeting.xml index b6d2e3d..1302da4 100644 --- a/project_scrum/views/project_scrum_meeting.xml +++ b/project_scrum/views/project_scrum_meeting.xml @@ -89,24 +89,28 @@ - + - + - + @@ -117,7 +121,6 @@ Meetings project.scrum.meeting - form tree,form,calendar {"search_default_current": 1} @@ -127,7 +130,6 @@ Meetings project.scrum.meeting - form tree,form,calendar diff --git a/project_scrum/views/project_scrum_sprint.xml b/project_scrum/views/project_scrum_sprint.xml index 2d8bc96..2c1b999 100644 --- a/project_scrum/views/project_scrum_sprint.xml +++ b/project_scrum/views/project_scrum_sprint.xml @@ -6,8 +6,11 @@ tree @@ -175,38 +178,54 @@ - + - + - + - + - + Sprints project.scrum.sprint - form tree,form,calendar,gantt,graph {"search_default_current": 1} diff --git a/project_scrum/views/project_scrum_test.xml b/project_scrum/views/project_scrum_test.xml index 200b826..0e5242a 100644 --- a/project_scrum/views/project_scrum_test.xml +++ b/project_scrum/views/project_scrum_test.xml @@ -20,10 +20,12 @@ >