-
-
Notifications
You must be signed in to change notification settings - Fork 702
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 #2280 from Yasaie/13.0-mig-project
[13.0][MIG] project
- Loading branch information
Showing
4 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
addons/project/migrations/13.0.1.1/openupgrade_analysis_work.txt
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,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 |
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,8 @@ | ||
# Copyright 2020 Payam Yasaie <https://www.tashilgostar.com> | ||
# 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') |
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,64 @@ | ||
# Copyright 2020 Payam Yasaie <https://www.tashilgostar.com> | ||
# 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, | ||
) |
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