From d7e6dc271d3ed13a9bfb43072c897ab2c91d34c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Tue, 12 Sep 2023 15:33:53 +0200 Subject: [PATCH 01/28] Add 'odoo_project_migration' Module integrating the migration data (provided by 'odoo_repository_migration') in Odoo projects to help the analysis of migration projects. --- odoo_project_migration/__init__.py | 2 + odoo_project_migration/__manifest__.py | 22 ++++ odoo_project_migration/models/__init__.py | 2 + odoo_project_migration/models/odoo_project.py | 65 ++++++++++ .../models/odoo_project_module_migration.py | 121 ++++++++++++++++++ .../security/ir.model.access.csv | 4 + odoo_project_migration/views/odoo_project.xml | 31 +++++ .../views/odoo_project_module_migration.xml | 72 +++++++++++ odoo_project_migration/wizards/__init__.py | 2 + .../wizards/create_migration_report.py | 39 ++++++ .../wizards/create_migration_report.xml | 35 +++++ .../wizards/generate_migration_data.py | 52 ++++++++ .../wizards/generate_migration_data.xml | 35 +++++ 13 files changed, 482 insertions(+) create mode 100644 odoo_project_migration/__init__.py create mode 100644 odoo_project_migration/__manifest__.py create mode 100644 odoo_project_migration/models/__init__.py create mode 100644 odoo_project_migration/models/odoo_project.py create mode 100644 odoo_project_migration/models/odoo_project_module_migration.py create mode 100644 odoo_project_migration/security/ir.model.access.csv create mode 100644 odoo_project_migration/views/odoo_project.xml create mode 100644 odoo_project_migration/views/odoo_project_module_migration.xml create mode 100644 odoo_project_migration/wizards/__init__.py create mode 100644 odoo_project_migration/wizards/create_migration_report.py create mode 100644 odoo_project_migration/wizards/create_migration_report.xml create mode 100644 odoo_project_migration/wizards/generate_migration_data.py create mode 100644 odoo_project_migration/wizards/generate_migration_data.xml diff --git a/odoo_project_migration/__init__.py b/odoo_project_migration/__init__.py new file mode 100644 index 00000000..aee8895e --- /dev/null +++ b/odoo_project_migration/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/odoo_project_migration/__manifest__.py b/odoo_project_migration/__manifest__.py new file mode 100644 index 00000000..5e1d9ec6 --- /dev/null +++ b/odoo_project_migration/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2023 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) +{ + "name": "Odoo Project Migration Data", + "summary": "Analyze your Odoo project migrations.", + "version": "16.0.1.0.0", + "category": "Tools", + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/TODO", + "data": [ + "security/ir.model.access.csv", + "views/odoo_project.xml", + "views/odoo_project_module_migration.xml", + "wizards/generate_migration_data.xml", + "wizards/create_migration_report.xml", + ], + "installable": True, + "depends": [ + "odoo_project", + ], + "license": "AGPL-3", +} diff --git a/odoo_project_migration/models/__init__.py b/odoo_project_migration/models/__init__.py new file mode 100644 index 00000000..5c26851a --- /dev/null +++ b/odoo_project_migration/models/__init__.py @@ -0,0 +1,2 @@ +from . import odoo_project_module_migration +from . import odoo_project diff --git a/odoo_project_migration/models/odoo_project.py b/odoo_project_migration/models/odoo_project.py new file mode 100644 index 00000000..84430df1 --- /dev/null +++ b/odoo_project_migration/models/odoo_project.py @@ -0,0 +1,65 @@ +# Copyright 2023 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +import ast + +from odoo import _, api, fields, models + + +class OdooProject(models.Model): + _inherit = "odoo.project" + + module_migration_ids = fields.One2many( + comodel_name="odoo.project.module.migration", + inverse_name="odoo_project_id", + string="Migration Data", + ) + migrations_count = fields.Integer(compute="_compute_migrations_count") + + @api.depends("module_branch_ids") + def _compute_migrations_count(self): + for rec in self: + rec.migrations_count = len(rec.module_migration_ids) + + def open_generate_migration_data(self): + self.ensure_one() + action = self.env["ir.actions.actions"]._for_xml_id( + "odoo_project_migration.odoo_project_generate_migration_data_action" + ) + ctx = action.get("context", {}) + if isinstance(ctx, str): + ctx = ast.literal_eval(ctx) + ctx["default_odoo_project_id"] = self.id + action["context"] = ctx + return action + + def open_create_migration_report(self): + self.ensure_one() + action = self.env["ir.actions.actions"]._for_xml_id( + "odoo_project_migration.odoo_project_create_migration_report_action" + ) + ctx = action.get("context", {}) + if isinstance(ctx, str): + ctx = ast.literal_eval(ctx) + ctx["default_odoo_project_id"] = self.id + action["context"] = ctx + return action + + def open_migration_data(self): + self.ensure_one() + action = self.env["ir.actions.actions"]._for_xml_id( + "odoo_project_migration.odoo_project_module_migration_action" + ) + ctx = action.get("context", {}) + if isinstance(ctx, str): + ctx = ast.literal_eval(ctx) + action["domain"] = [("odoo_project_id", "=", self.id)] + migration_paths = self.module_migration_ids.migration_path_id + if len(migration_paths) == 1: + action["display_name"] = _("Migration") + f" {migration_paths.name}" + else: + ctx["search_default_group_by_migration_path_id"] = 1 + ctx["search_default_group_by_org_id"] = 2 + ctx["search_default_group_by_state"] = 3 + action["context"] = ctx + return action diff --git a/odoo_project_migration/models/odoo_project_module_migration.py b/odoo_project_migration/models/odoo_project_module_migration.py new file mode 100644 index 00000000..09a9b539 --- /dev/null +++ b/odoo_project_migration/models/odoo_project_module_migration.py @@ -0,0 +1,121 @@ +# Copyright 2023 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import api, fields, models + + +class OdooProjectModuleMigration(models.Model): + _name = "odoo.project.module.migration" + # TODO test to inherit from 'module_migration_id' field too + _inherits = {"odoo.module.branch": "source_module_branch_id"} + _description = "Module migration line of an Odoo Project" + _order = "is_standard DESC, is_enterprise, is_community DESC, repository_id, module_name" + + _sql_constraints = [ + ( + "uniq", + "UNIQUE (odoo_project_id, migration_path_id, source_module_branch_id)", + "This module migration path already exists." + ), + ] + + odoo_project_id = fields.Many2one( + comodel_name="odoo.project", + ondelete="cascade", + string="Project", + required=True, + index=True, + readonly=True, + ) + migration_path_id = fields.Many2one( + comodel_name="odoo.migration.path", + ondelete="restrict", + string="Migration Path", + required=True, + index=True, + readonly=True, + ) + source_module_branch_id = fields.Many2one( + comodel_name="odoo.module.branch", + ondelete="restrict", + string="Source", + required=True, + index=True, + readonly=True, + ) + target_module_branch_id = fields.Many2one( + comodel_name="odoo.module.branch", + ondelete="restrict", + string="Target", + compute="_compute_target_module_branch_id", + store=True, + index=True, + ) + module_id = fields.Many2one( + related="source_module_branch_id.module_id", + store=True, + index=True, + ) + module_migration_id = fields.Many2one( + comodel_name="odoo.module.branch.migration", + ondelete="restrict", + string="Migration", + compute="_compute_module_migration_id", + store=True, + index=True, + ) + state = fields.Selection( + # Same as in 'odoo.module.branch.migration' but set a state even for + # modules with no migration data, could be Odoo S.A. std modules + # or project specific ones. + selection=[ + ("fully_ported", "Fully Ported"), + ("migrate", "To migrate"), + ("port_commits", "Commits to port"), + ("review_migration", "Migration to review"), + # New states to qualify modules without migration data + ("available", "Available"), + ("removed", "Removed"), + ], + string="Migration status", + compute="_compute_state", + store=True, + index=True, + ) + results_text = fields.Text(related="module_migration_id.results_text") + pr_url = fields.Char(related="module_migration_id.pr_url") + + @api.depends("source_module_branch_id", "migration_path_id") + def _compute_target_module_branch_id(self): + for rec in self: + rec.target_module_branch_id = rec.source_module_branch_id.search( + [ + ("module_id", "=", rec.source_module_branch_id.module_id.id), + ("branch_id", "=", rec.migration_path_id.target_branch_id.id), + ("installable", "=", True), + ] + ) + + @api.depends("migration_path_id", "source_module_branch_id") + def _compute_module_migration_id(self): + migration_model = self.env["odoo.module.branch.migration"] + for rec in self: + rec.module_migration_id = migration_model.search( + [ + ("migration_path_id", "=", rec.migration_path_id.id), + ("module_branch_id", "=", rec.source_module_branch_id.id), + ] + ) + + @api.depends("module_migration_id.state") + def _compute_state(self): + for rec in self: + rec.state = rec.module_migration_id.state + if not rec.module_migration_id: + # Default state (used by project specific modules) + rec.state = "migrate" + # Odoo S.A. modules + if rec.source_module_branch_id.is_standard: + rec.state = ( + "available" if rec.target_module_branch_id else "removed" + ) diff --git a/odoo_project_migration/security/ir.model.access.csv b/odoo_project_migration/security/ir.model.access.csv new file mode 100644 index 00000000..4e5cd678 --- /dev/null +++ b/odoo_project_migration/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_odoo_project_module_migration_user,odoo_project_module_migration_user,model_odoo_project_module_migration,base.group_user,1,0,0,0 +access_odoo_project_generate_migration_data_user,odoo_project_generate_migration_data_user,model_odoo_project_generate_migration_data,base.group_user,1,1,1,1 +access_odoo_project_create_migration_report_user,odoo_project_create_migration_report_user,model_odoo_project_create_migration_report,base.group_user,1,1,1,1 diff --git a/odoo_project_migration/views/odoo_project.xml b/odoo_project_migration/views/odoo_project.xml new file mode 100644 index 00000000..f1b415f4 --- /dev/null +++ b/odoo_project_migration/views/odoo_project.xml @@ -0,0 +1,31 @@ + + + + + + odoo.project.form.inherit + odoo.project + + +
+ +
+
+ +
+
+
+ +
diff --git a/odoo_project_migration/views/odoo_project_module_migration.xml b/odoo_project_migration/views/odoo_project_module_migration.xml new file mode 100644 index 00000000..221ba8ed --- /dev/null +++ b/odoo_project_migration/views/odoo_project_module_migration.xml @@ -0,0 +1,72 @@ + + + + + + odoo.project.module.migration.form + odoo.project.module.migration + +
+ + + + + + + + + + + + + +
+
+
+ + + odoo.project.module.migration.tree + odoo.project.module.migration + + + + + + + + + + + + + + + + + + + + + odoo.project.module.migration.search + odoo.project.module.migration + + primary + + + + + + + + + + Migrations + ir.actions.act_window + odoo.project.module.migration + + + +
diff --git a/odoo_project_migration/wizards/__init__.py b/odoo_project_migration/wizards/__init__.py new file mode 100644 index 00000000..0c66bbd1 --- /dev/null +++ b/odoo_project_migration/wizards/__init__.py @@ -0,0 +1,2 @@ +from . import generate_migration_data +from . import create_migration_report diff --git a/odoo_project_migration/wizards/create_migration_report.py b/odoo_project_migration/wizards/create_migration_report.py new file mode 100644 index 00000000..d537ce72 --- /dev/null +++ b/odoo_project_migration/wizards/create_migration_report.py @@ -0,0 +1,39 @@ +# Copyright 2023 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import api, fields, models + + +class OdooProjectCreateMigrationReport(models.TransientModel): + _name = "odoo.project.create.migration.report" + _description = "Create a migration report for an Odoo project" + + odoo_project_id = fields.Many2one( + comodel_name="odoo.project", + string="Project", + required=True, + ) + odoo_version_id = fields.Many2one(related="odoo_project_id.odoo_version_id") + available_migration_path_ids = fields.One2many( + comodel_name="odoo.migration.path", + compute="_compute_available_migration_path_ids", + string="Available Migration Paths", + ) + migration_path_id = fields.Many2one( + comodel_name="odoo.migration.path", + string="Migration Path", + required=True, + ) + + @api.depends("odoo_project_id") + def _compute_available_migration_path_ids(self): + for rec in self: + rec.available_migration_path_ids = ( + rec.odoo_project_id.module_migration_ids.migration_path_id + ) + + def action_create_report(self): + """Create a migration report for the given Odoo project.""" + self.ensure_one() + # TODO + return True diff --git a/odoo_project_migration/wizards/create_migration_report.xml b/odoo_project_migration/wizards/create_migration_report.xml new file mode 100644 index 00000000..56cd1183 --- /dev/null +++ b/odoo_project_migration/wizards/create_migration_report.xml @@ -0,0 +1,35 @@ + + + + + + odoo.project.create.migration.report.form + odoo.project.create.migration.report + +
+ + + + + + + + +
+
+
+
+
+ + + Create a migration report + ir.actions.act_window + odoo.project.create.migration.report + form + new + + +
diff --git a/odoo_project_migration/wizards/generate_migration_data.py b/odoo_project_migration/wizards/generate_migration_data.py new file mode 100644 index 00000000..71b1b5c1 --- /dev/null +++ b/odoo_project_migration/wizards/generate_migration_data.py @@ -0,0 +1,52 @@ +# Copyright 2023 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import _, fields, models + + +class OdooProjectGenerateMigrationData(models.TransientModel): + _name = "odoo.project.generate.migration.data" + _description = "Generate migration data for an Odoo project" + + odoo_project_id = fields.Many2one( + comodel_name="odoo.project", + string="Project", + required=True, + ) + odoo_version_id = fields.Many2one(related="odoo_project_id.odoo_version_id") + migration_path_id = fields.Many2one( + comodel_name="odoo.migration.path", + string="Migration Path", + required=True, + ) + + def action_generate_data(self): + """Generate migration data for the given Odoo project.""" + self.ensure_one() + module_migration_model = self.env["odoo.project.module.migration"] + module_migrations_to_unlink = module_migration_model.search( + [ + ("odoo_project_id", "=", self.odoo_project_id.id), + ("migration_path_id", "=", self.migration_path_id.id), + ] + ) + module_migrations_to_unlink.sudo().unlink() + values_list = [] + for module_branch in self.odoo_project_id.module_branch_ids: + values = self._prepare_module_migration_values(module_branch) + values_list.append(values) + module_migration_model.sudo().create(values_list) + # Open the generated migration data + action = self.odoo_project_id.open_migration_data() + action["domain"].append( + ("migration_path_id", "=", self.migration_path_id.id) + ) + action["display_name"] = _("Migration") + f" {self.migration_path_id.name}" + return action + + def _prepare_module_migration_values(self, module_branch): + return { + "odoo_project_id": self.odoo_project_id.id, + "migration_path_id": self.migration_path_id.id, + "source_module_branch_id": module_branch.id, + } diff --git a/odoo_project_migration/wizards/generate_migration_data.xml b/odoo_project_migration/wizards/generate_migration_data.xml new file mode 100644 index 00000000..dd3f8ff7 --- /dev/null +++ b/odoo_project_migration/wizards/generate_migration_data.xml @@ -0,0 +1,35 @@ + + + + + + odoo.project.generate.migration.data.form + odoo.project.generate.migration.data + +
+ + + + + + + + +
+
+
+
+
+ + + Generate migration data + ir.actions.act_window + odoo.project.generate.migration.data + form + new + + +
From 8316084faf108da5717e0c9ea2e70618d35b9994 Mon Sep 17 00:00:00 2001 From: SilvioC2C Date: Tue, 26 Sep 2023 17:13:31 +0200 Subject: [PATCH 02/28] Fix 'odoo_project_migration' dependency --- odoo_project_migration/__manifest__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/odoo_project_migration/__manifest__.py b/odoo_project_migration/__manifest__.py index 5e1d9ec6..1e171566 100644 --- a/odoo_project_migration/__manifest__.py +++ b/odoo_project_migration/__manifest__.py @@ -17,6 +17,7 @@ "installable": True, "depends": [ "odoo_project", + "odoo_repository_migration", ], "license": "AGPL-3", } From 239794a69fcfbf8d0836f709fbb73943110b9514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Fri, 3 Nov 2023 11:13:16 +0100 Subject: [PATCH 03/28] New data model 'odoo.project.module' This new data model is here to distinguish available upstream modules and installed modules in a project. It inherits from `odoo.module.branch` so it has access to all its data, but is linked to an `odoo.project` and has its own `installed_version` so it becomes easy to find modules that could be upgraded within a project. --- odoo_project_migration/models/odoo_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo_project_migration/models/odoo_project.py b/odoo_project_migration/models/odoo_project.py index 84430df1..ed8eba10 100644 --- a/odoo_project_migration/models/odoo_project.py +++ b/odoo_project_migration/models/odoo_project.py @@ -16,7 +16,7 @@ class OdooProject(models.Model): ) migrations_count = fields.Integer(compute="_compute_migrations_count") - @api.depends("module_branch_ids") + @api.depends("module_migration_ids") def _compute_migrations_count(self): for rec in self: rec.migrations_count = len(rec.module_migration_ids) From 0a4d894466a1c11895e0fb3926b9ae264cd44c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Fri, 3 Nov 2023 12:13:31 +0100 Subject: [PATCH 04/28] Apply pre-commit --- odoo_project_migration/README.rst | 62 +++ odoo_project_migration/__manifest__.py | 2 +- .../models/odoo_project_module_migration.py | 6 +- .../readme/CONTRIBUTORS.rst | 2 + odoo_project_migration/readme/DESCRIPTION.rst | 2 + .../static/description/index.html | 418 ++++++++++++++++++ odoo_project_migration/views/odoo_project.xml | 35 +- .../views/odoo_project_module_migration.xml | 64 +-- .../wizards/create_migration_report.xml | 27 +- .../wizards/generate_migration_data.py | 4 +- .../wizards/generate_migration_data.xml | 30 +- 11 files changed, 590 insertions(+), 62 deletions(-) create mode 100644 odoo_project_migration/README.rst create mode 100644 odoo_project_migration/readme/CONTRIBUTORS.rst create mode 100644 odoo_project_migration/readme/DESCRIPTION.rst create mode 100644 odoo_project_migration/static/description/index.html diff --git a/odoo_project_migration/README.rst b/odoo_project_migration/README.rst new file mode 100644 index 00000000..8419126a --- /dev/null +++ b/odoo_project_migration/README.rst @@ -0,0 +1,62 @@ +=========================== +Odoo Project Migration Data +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7869663d85e4e7b57d969ad2db983c2a85fbab36cc9c158a3227cdb3b13cb581 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-camptocamp%2Fodoo--repository-lightgray.png?logo=github + :target: https://github.com/camptocamp/odoo-repository/tree/16.0/odoo_project_migration + :alt: camptocamp/odoo-repository + +|badge1| |badge2| |badge3| + +This module integrates the migration data collected by `odoo_repository_migration` +in your Odoo projects, allowing to analyze their migrations. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Camptocamp + * Sébastien Alix + +Maintainers +~~~~~~~~~~~ + +This module is part of the `camptocamp/odoo-repository `_ project on GitHub. + +You are welcome to contribute. diff --git a/odoo_project_migration/__manifest__.py b/odoo_project_migration/__manifest__.py index 1e171566..90bd9c7c 100644 --- a/odoo_project_migration/__manifest__.py +++ b/odoo_project_migration/__manifest__.py @@ -6,7 +6,7 @@ "version": "16.0.1.0.0", "category": "Tools", "author": "Camptocamp, Odoo Community Association (OCA)", - "website": "https://github.com/OCA/TODO", + "website": "https://github.com/camptocamp/odoo-repository", "data": [ "security/ir.model.access.csv", "views/odoo_project.xml", diff --git a/odoo_project_migration/models/odoo_project_module_migration.py b/odoo_project_migration/models/odoo_project_module_migration.py index 09a9b539..74d1d073 100644 --- a/odoo_project_migration/models/odoo_project_module_migration.py +++ b/odoo_project_migration/models/odoo_project_module_migration.py @@ -9,13 +9,15 @@ class OdooProjectModuleMigration(models.Model): # TODO test to inherit from 'module_migration_id' field too _inherits = {"odoo.module.branch": "source_module_branch_id"} _description = "Module migration line of an Odoo Project" - _order = "is_standard DESC, is_enterprise, is_community DESC, repository_id, module_name" + _order = ( + "is_standard DESC, is_enterprise, is_community DESC, repository_id, module_name" + ) _sql_constraints = [ ( "uniq", "UNIQUE (odoo_project_id, migration_path_id, source_module_branch_id)", - "This module migration path already exists." + "This module migration path already exists.", ), ] diff --git a/odoo_project_migration/readme/CONTRIBUTORS.rst b/odoo_project_migration/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..a0c91e35 --- /dev/null +++ b/odoo_project_migration/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Camptocamp + * Sébastien Alix diff --git a/odoo_project_migration/readme/DESCRIPTION.rst b/odoo_project_migration/readme/DESCRIPTION.rst new file mode 100644 index 00000000..87f17cec --- /dev/null +++ b/odoo_project_migration/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module integrates the migration data collected by `odoo_repository_migration` +in your Odoo projects, allowing to analyze their migrations. diff --git a/odoo_project_migration/static/description/index.html b/odoo_project_migration/static/description/index.html new file mode 100644 index 00000000..05831ea9 --- /dev/null +++ b/odoo_project_migration/static/description/index.html @@ -0,0 +1,418 @@ + + + + + + +Odoo Project Migration Data + + + +
+

Odoo Project Migration Data

+ + +

Beta License: AGPL-3 camptocamp/odoo-repository

+

This module integrates the migration data collected by odoo_repository_migration +in your Odoo projects, allowing to analyze their migrations.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the camptocamp/odoo-repository project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/odoo_project_migration/views/odoo_project.xml b/odoo_project_migration/views/odoo_project.xml index f1b415f4..9e8b5d27 100644 --- a/odoo_project_migration/views/odoo_project.xml +++ b/odoo_project_migration/views/odoo_project.xml @@ -1,4 +1,4 @@ - + @@ -6,21 +6,34 @@ odoo.project.form.inherit odoo.project - +
- -
- diff --git a/odoo_project_migration/views/odoo_project_module_migration.xml b/odoo_project_migration/views/odoo_project_module_migration.xml index 221ba8ed..e7fa7a6b 100644 --- a/odoo_project_migration/views/odoo_project_module_migration.xml +++ b/odoo_project_migration/views/odoo_project_module_migration.xml @@ -1,4 +1,4 @@ - + @@ -10,15 +10,15 @@
- - - - - - - - - + + + + + + + + +
@@ -30,19 +30,19 @@ odoo.project.module.migration - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -50,14 +50,20 @@ odoo.project.module.migration.search odoo.project.module.migration - + primary - - + + @@ -66,7 +72,7 @@ Migrations ir.actions.act_window odoo.project.module.migration - +
diff --git a/odoo_project_migration/wizards/create_migration_report.xml b/odoo_project_migration/wizards/create_migration_report.xml index 56cd1183..bd343b65 100644 --- a/odoo_project_migration/wizards/create_migration_report.xml +++ b/odoo_project_migration/wizards/create_migration_report.xml @@ -1,4 +1,4 @@ - + @@ -10,21 +10,32 @@
- - - - + + + +
-
- + Create a migration report ir.actions.act_window odoo.project.create.migration.report diff --git a/odoo_project_migration/wizards/generate_migration_data.py b/odoo_project_migration/wizards/generate_migration_data.py index 71b1b5c1..f399cc42 100644 --- a/odoo_project_migration/wizards/generate_migration_data.py +++ b/odoo_project_migration/wizards/generate_migration_data.py @@ -38,9 +38,7 @@ def action_generate_data(self): module_migration_model.sudo().create(values_list) # Open the generated migration data action = self.odoo_project_id.open_migration_data() - action["domain"].append( - ("migration_path_id", "=", self.migration_path_id.id) - ) + action["domain"].append(("migration_path_id", "=", self.migration_path_id.id)) action["display_name"] = _("Migration") + f" {self.migration_path_id.name}" return action diff --git a/odoo_project_migration/wizards/generate_migration_data.xml b/odoo_project_migration/wizards/generate_migration_data.xml index dd3f8ff7..ae6ce895 100644 --- a/odoo_project_migration/wizards/generate_migration_data.xml +++ b/odoo_project_migration/wizards/generate_migration_data.xml @@ -1,4 +1,4 @@ - + @@ -10,21 +10,35 @@
- - - + + + - +
-
- + Generate migration data ir.actions.act_window odoo.project.generate.migration.data From 0f7f685935edaf121f55d0834ed010233c850fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Sat, 4 Nov 2023 11:44:11 +0100 Subject: [PATCH 05/28] odoo_project_migration: fix generation of migration data --- odoo_project_migration/wizards/generate_migration_data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odoo_project_migration/wizards/generate_migration_data.py b/odoo_project_migration/wizards/generate_migration_data.py index f399cc42..81203f04 100644 --- a/odoo_project_migration/wizards/generate_migration_data.py +++ b/odoo_project_migration/wizards/generate_migration_data.py @@ -32,7 +32,8 @@ def action_generate_data(self): ) module_migrations_to_unlink.sudo().unlink() values_list = [] - for module_branch in self.odoo_project_id.module_branch_ids: + modules_branch = self.odoo_project_id.project_module_ids.module_branch_id + for module_branch in modules_branch: values = self._prepare_module_migration_values(module_branch) values_list.append(values) module_migration_model.sudo().create(values_list) From 30927a2fce21d71cb5f5bc84ab834ed48fb1242c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Sat, 4 Nov 2023 16:57:37 +0100 Subject: [PATCH 06/28] odoo_project_migration: export migration data in CSV --- odoo_project_migration/README.rst | 2 +- odoo_project_migration/__manifest__.py | 2 +- odoo_project_migration/models/odoo_project.py | 4 +- .../security/ir.model.access.csv | 2 +- .../static/description/index.html | 2 +- odoo_project_migration/views/odoo_project.xml | 4 +- odoo_project_migration/wizards/__init__.py | 2 +- .../wizards/create_migration_report.py | 39 ----- .../wizards/export_migration_report.py | 145 ++++++++++++++++++ ...report.xml => export_migration_report.xml} | 16 +- 10 files changed, 162 insertions(+), 56 deletions(-) delete mode 100644 odoo_project_migration/wizards/create_migration_report.py create mode 100644 odoo_project_migration/wizards/export_migration_report.py rename odoo_project_migration/wizards/{create_migration_report.xml => export_migration_report.xml} (71%) diff --git a/odoo_project_migration/README.rst b/odoo_project_migration/README.rst index 8419126a..2e2b41df 100644 --- a/odoo_project_migration/README.rst +++ b/odoo_project_migration/README.rst @@ -7,7 +7,7 @@ Odoo Project Migration Data !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:7869663d85e4e7b57d969ad2db983c2a85fbab36cc9c158a3227cdb3b13cb581 + !! source digest: sha256:fddc557b125df28e6f91ead7ae3d54cc69c61f2bea2538aeffe760094fc0e181 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/odoo_project_migration/__manifest__.py b/odoo_project_migration/__manifest__.py index 90bd9c7c..658be1f3 100644 --- a/odoo_project_migration/__manifest__.py +++ b/odoo_project_migration/__manifest__.py @@ -12,7 +12,7 @@ "views/odoo_project.xml", "views/odoo_project_module_migration.xml", "wizards/generate_migration_data.xml", - "wizards/create_migration_report.xml", + "wizards/export_migration_report.xml", ], "installable": True, "depends": [ diff --git a/odoo_project_migration/models/odoo_project.py b/odoo_project_migration/models/odoo_project.py index ed8eba10..ee9b3292 100644 --- a/odoo_project_migration/models/odoo_project.py +++ b/odoo_project_migration/models/odoo_project.py @@ -33,10 +33,10 @@ def open_generate_migration_data(self): action["context"] = ctx return action - def open_create_migration_report(self): + def open_export_migration_report(self): self.ensure_one() action = self.env["ir.actions.actions"]._for_xml_id( - "odoo_project_migration.odoo_project_create_migration_report_action" + "odoo_project_migration.odoo_project_export_migration_report_action" ) ctx = action.get("context", {}) if isinstance(ctx, str): diff --git a/odoo_project_migration/security/ir.model.access.csv b/odoo_project_migration/security/ir.model.access.csv index 4e5cd678..c8edff14 100644 --- a/odoo_project_migration/security/ir.model.access.csv +++ b/odoo_project_migration/security/ir.model.access.csv @@ -1,4 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_odoo_project_module_migration_user,odoo_project_module_migration_user,model_odoo_project_module_migration,base.group_user,1,0,0,0 access_odoo_project_generate_migration_data_user,odoo_project_generate_migration_data_user,model_odoo_project_generate_migration_data,base.group_user,1,1,1,1 -access_odoo_project_create_migration_report_user,odoo_project_create_migration_report_user,model_odoo_project_create_migration_report,base.group_user,1,1,1,1 +access_odoo_project_export_migration_report_user,odoo_project_export_migration_report_user,model_odoo_project_export_migration_report,base.group_user,1,1,1,1 diff --git a/odoo_project_migration/static/description/index.html b/odoo_project_migration/static/description/index.html index 05831ea9..8a4d2a7d 100644 --- a/odoo_project_migration/static/description/index.html +++ b/odoo_project_migration/static/description/index.html @@ -367,7 +367,7 @@

Odoo Project Migration Data

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:7869663d85e4e7b57d969ad2db983c2a85fbab36cc9c158a3227cdb3b13cb581 +!! source digest: sha256:fddc557b125df28e6f91ead7ae3d54cc69c61f2bea2538aeffe760094fc0e181 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 camptocamp/odoo-repository

This module integrates the migration data collected by odoo_repository_migration diff --git a/odoo_project_migration/views/odoo_project.xml b/odoo_project_migration/views/odoo_project.xml index 9e8b5d27..b01e2b23 100644 --- a/odoo_project_migration/views/odoo_project.xml +++ b/odoo_project_migration/views/odoo_project.xml @@ -17,9 +17,9 @@ class="btn-secondary" /> -

-
-
- +
+ + + + Migration Data +
+ + + +
diff --git a/odoo_project_migration/views/odoo_project_module_migration.xml b/odoo_project_migration/views/odoo_project_module_migration.xml index 451b6fab..f2da9211 100644 --- a/odoo_project_migration/views/odoo_project_module_migration.xml +++ b/odoo_project_migration/views/odoo_project_module_migration.xml @@ -2,94 +2,106 @@ + + odoo.project.module.migration.form + odoo.project.module.migration + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
- - odoo.project.module.migration.form - odoo.project.module.migration - -
- - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - odoo.project.module.migration.tree - odoo.project.module.migration - - - - - - - - - - - - - - - - - - - - - - - - - odoo.project.module.migration.search - odoo.project.module.migration - - primary - - - + + odoo.project.module.migration.tree + odoo.project.module.migration + + + + + + + + + + + + + + + + + + + + - - + + + odoo.project.module.migration.search + odoo.project.module.migration + + primary + + + + + + - - - - - - - Migrations - ir.actions.act_window - odoo.project.module.migration - - + + + + + Migrations + ir.actions.act_window + odoo.project.module.migration + +
diff --git a/odoo_project_migration/wizards/export_migration_report.xml b/odoo_project_migration/wizards/export_migration_report.xml index bb76caba..b3ac38bd 100644 --- a/odoo_project_migration/wizards/export_migration_report.xml +++ b/odoo_project_migration/wizards/export_migration_report.xml @@ -2,45 +2,43 @@ - - - odoo.project.export.migration.report.form - odoo.project.export.migration.report - -
- - - - - - + odoo.project.export.migration.report.form + odoo.project.export.migration.report + + + + + + + + - - -
-
- -
-
+