diff --git a/addons/project/migrations/13.0.1.1/openupgrade_analysis_work.txt b/addons/project/migrations/13.0.1.1/openupgrade_analysis_work.txt new file mode 100644 index 000000000000..50a4d0805975 --- /dev/null +++ b/addons/project/migrations/13.0.1.1/openupgrade_analysis_work.txt @@ -0,0 +1,50 @@ +---Models in module 'project'--- +---Fields in module 'project'--- +project / account.analytic.account / project_count (integer) : previously in module hr_timesheet +project / account.analytic.account / project_ids (one2many) : previously in module hr_timesheet +project / project.project / analytic_account_id (many2one): previously in module hr_timesheet +# DONE: pre-migration: Update field definition + +project / project.project / percentage_satisfaction_project (integer): DEL +project / project.project / percentage_satisfaction_task (integer): DEL +# NOTHING TO DO: Features removed + +project / project.project / rating_ids (one2many) : NEW relation: rating.rating +# NOTHING TO DO: New one2many field + +project / project.task / company_id (many2one) : now required, req_default: function +# DONE: pre-migration: filled the field when empty + +project / project.task / date_start (datetime) : DEL +project / project.task / notes (text) : DEL +project / project.task.type / legend_priority (char) : DEL +# NOTHING TO DO: Features removed + +---XML records in module 'project'--- +NEW ir.model.access: project.access_account_analytic_account_manager [renamed from hr_timesheet module] +NEW ir.model.access: project.access_account_analytic_account_user [renamed from hr_timesheet module] +NEW ir.model.access: project.access_account_analytic_line_project [renamed from hr_timesheet module] +# DONE: pre-migration (renamed) + +NEW ir.module.category: base.module_category_operations_project (noupdate) +# NOTHING TO DO: New record + +NEW ir.actions.act_window: project.portal_share_action +NEW ir.ui.view: project.account_analytic_account_view_form_inherit +NEW ir.ui.view: project.project_project_view_form_simplified_footer +NEW ir.ui.view: project.project_tags_tree_view +NEW ir.ui.view: project.project_task_view_activity +DEL ir.ui.view: project.qunit_suite +# NOTHING TO DO: noupdate=0 ir records + +mail.message.subtype: project.mt_project_task_blocked (noupdate) (noupdate switched) +mail.message.subtype: project.mt_project_task_new (noupdate) (noupdate switched) +mail.message.subtype: project.mt_project_task_rating (noupdate) (noupdate switched) +mail.message.subtype: project.mt_project_task_ready (noupdate) (noupdate switched) +mail.message.subtype: project.mt_project_task_stage (noupdate) (noupdate switched) +mail.message.subtype: project.mt_task_blocked (noupdate) (noupdate switched) +mail.message.subtype: project.mt_task_new (noupdate) (noupdate switched) +mail.message.subtype: project.mt_task_rating (noupdate) (noupdate switched) +mail.message.subtype: project.mt_task_ready (noupdate) (noupdate switched) +mail.message.subtype: project.mt_task_stage (noupdate) (noupdate switched) +# DONE: pre-migration diff --git a/addons/project/migrations/13.0.1.1/post-migration.py b/addons/project/migrations/13.0.1.1/post-migration.py new file mode 100644 index 000000000000..9f4b1718d6bc --- /dev/null +++ b/addons/project/migrations/13.0.1.1/post-migration.py @@ -0,0 +1,8 @@ +# Copyright 2020 Payam Yasaie +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, 'project', 'migrations/13.0.1.1/noupdate_changes.xml') diff --git a/addons/project/migrations/13.0.1.1/pre-migration.py b/addons/project/migrations/13.0.1.1/pre-migration.py new file mode 100644 index 000000000000..68187343f02a --- /dev/null +++ b/addons/project/migrations/13.0.1.1/pre-migration.py @@ -0,0 +1,64 @@ +# Copyright 2020 Payam Yasaie +# Copyright 2020 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + +_xmlid_renames = [ + ('hr_timesheet.access_account_analytic_account_manager', 'project.access_account_analytic_account_manager'), + ('hr_timesheet.access_account_analytic_account_user', 'project.access_account_analytic_account_user'), + ('hr_timesheet.access_account_analytic_line_project', 'project.access_account_analytic_line_project'), +] + + +def update_module_moved_fields(env): + if not openupgrade.is_module_installed(env.cr, "hr_timesheet"): + return + openupgrade.update_module_moved_fields( + env.cr, + "account.analytic.account", + ["project_count", "project_ids"], + "hr_timesheet", + "project", + ) + openupgrade.update_module_moved_fields( + env.cr, + "project.project", + ["analytic_account_id"], + "hr_timesheet", + "project", + ) + + +def fill_project_task_company_id(cr): + openupgrade.logged_query( + cr, """ + UPDATE project_task pt + SET company_id = pp.company_id + FROM project_project pp + WHERE pp.id = pt.project_id AND pt.company_id IS NULL + """ + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.rename_xmlids(env.cr, _xmlid_renames) + update_module_moved_fields(env) + fill_project_task_company_id(env.cr) + openupgrade.set_xml_ids_noupdate_value( + env, + "project", + [ + "mt_project_task_blocked", + "mt_project_task_new", + "mt_project_task_rating", + "mt_project_task_ready", + "mt_project_task_stage", + "mt_task_blocked", + "mt_task_new", + "mt_task_rating", + "mt_task_ready", + "mt_task_stage", + ], + True, + ) diff --git a/odoo/openupgrade/doc/source/modules120-130.rst b/odoo/openupgrade/doc/source/modules120-130.rst index 175f4526f663..ba1b597f7aa8 100644 --- a/odoo/openupgrade/doc/source/modules120-130.rst +++ b/odoo/openupgrade/doc/source/modules120-130.rst @@ -533,7 +533,7 @@ missing in the new release are marked with |del|. +----------------------------------------------+-------------------------------------------------+ | |new| product_matrix | | +----------------------------------------------+-------------------------------------------------+ -|project | | +|project | Done | +----------------------------------------------+-------------------------------------------------+ |project_timesheet_holidays | | +----------------------------------------------+-------------------------------------------------+