← Back to team overview

credativ team mailing list archive

[Merge] lp:~pedro.baeza/openupgrade-addons/7.0-project into lp:openupgrade-addons

 

Pedro Manuel Baeza has proposed merging lp:~pedro.baeza/openupgrade-addons/7.0-project into lp:openupgrade-addons.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~pedro.baeza/openupgrade-addons/7.0-project/+merge/210214

[ADD] project: Analysis work and migration scripts.
-- 
https://code.launchpad.net/~pedro.baeza/openupgrade-addons/7.0-project/+merge/210214
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~pedro.baeza/openupgrade-addons/7.0-project into lp:openupgrade-addons.
=== added file 'hr_holidays/migrations/7.0.1.5/openupgrade_analysis_work.txt'
--- hr_holidays/migrations/7.0.1.5/openupgrade_analysis_work.txt	1970-01-01 00:00:00 +0000
+++ hr_holidays/migrations/7.0.1.5/openupgrade_analysis_work.txt	2014-03-10 14:26:20 +0000
@@ -0,0 +1,58 @@
+---Fields in module 'hr_holidays'---
+hr_holidays  / hr.employee              / last_login (datetime)         : module is now 'hr' ('hr_holidays')
+### -> hr is a dependency, so this is not a problem
+
+hr_holidays  / hr.holidays              / case_id (many2one)            : DEL relation: crm.meeting
+hr_holidays  / hr.holidays              / meeting_id (many2one)         : NEW relation: crm.meeting
+### -> just renamed
+
+hr_holidays  / hr.holidays              / message_ids (one2many)        : NEW relation: mail.message
+### -> new functionality of mail module: nothing to do.
+
+hr_holidays  / hr.holidays.status       / categ_id (many2one)           : relation is now 'crm.meeting.type' ('crm.case.categ')
+---XML records in module 'hr_holidays'---
+NEW ir.actions.act_window: hr_holidays.act_hr_leave_request_to_meeting
+NEW ir.actions.act_window: hr_holidays.request_approve_allocation
+DEL ir.actions.act_window: hr_holidays.action_view_holiday_status_manager_board
+NEW ir.actions.act_window.view: hr_holidays.action_request_approve_allocation_form
+NEW ir.actions.act_window.view: hr_holidays.action_request_approve_allocation_tree
+### -> New act_window: Nothing to do
+
+NEW ir.actions.todo: base.open_menu
+DEL ir.actions.todo: hr_holidays.hr_holidays_leaves_assign_form_view_todo
+### -> New configuration wizards: Nothing to do
+
+NEW ir.model.access: hr_holidays.access_crm_meeting_type_manager
+NEW ir.model.access: hr_holidays.access_resource_calendar_leaves_user
+DEL ir.model.access: hr_holidays.access_resource_calendar_leaves_manager
+NEW ir.rule: hr_holidays.property_rule_holidays_officer
+DEL ir.rule: hr_holidays.property_rule_holidays_manager
+### -> TODO: New security: Change users that belongs to old group to another one
+
+NEW ir.ui.menu: hr_holidays.menu_request_approve_allocation
+DEL ir.ui.menu: hr_holidays.menu_hr_reporting_holidays
+### -> New menus: Nothing to do
+
+DEL ir.ui.view: hr_holidays.board_hr_holidays_manager_form
+### -> New view: Nothing to do
+
+NEW mail.message: hr_holidays.module_install_notification
+NEW mail.message.subtype: hr_holidays.mt_holidays_approved
+NEW mail.message.subtype: hr_holidays.mt_holidays_confirmed
+NEW mail.message.subtype: hr_holidays.mt_holidays_refused
+### -> New messages from chatter: Nothing to do
+
+NEW workflow.transition: hr_holidays.holiday_confirm2refuse
+NEW workflow.transition: hr_holidays.holiday_confirm2validate
+NEW workflow.transition: hr_holidays.holiday_confirm2validate1
+NEW workflow.transition: hr_holidays.holiday_draft2confirm
+NEW workflow.transition: hr_holidays.holiday_validate1_refuse
+NEW workflow.transition: hr_holidays.holiday_validate1_validate
+NEW workflow.transition: hr_holidays.holiday_validate2refuse
+DEL workflow.transition: hr_holidays.t1
+DEL workflow.transition: hr_holidays.t11
+DEL workflow.transition: hr_holidays.t2
+DEL workflow.transition: hr_holidays.t3
+DEL workflow.transition: hr_holidays.t4
+DEL workflow.transition: hr_holidays.t8
+### -> New conditions for jump between activities: Nothing to do

=== added file 'hr_holidays/migrations/7.0.1.5/pre-migration.py'
--- hr_holidays/migrations/7.0.1.5/pre-migration.py	1970-01-01 00:00:00 +0000
+++ hr_holidays/migrations/7.0.1.5/pre-migration.py	2014-03-10 14:26:20 +0000
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This migration script copyright (C) 2014
+#                    Pedro M. Baeza (pedro.baeza@xxxxxxxxxxxxxxxxxx)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openupgrade import openupgrade
+
+column_renames = {
+    'hr_holidays': [
+        ('case_id', 'meeting_id'),
+    ]
+}
+
+@openupgrade.migrate()
+def migrate(cr, version):
+    openupgrade.rename_columns(cr, column_renames)

=== added file 'project/migrations/7.0.1.1/openupgrade_analysis_work.txt'
--- project/migrations/7.0.1.1/openupgrade_analysis_work.txt	1970-01-01 00:00:00 +0000
+++ project/migrations/7.0.1.1/openupgrade_analysis_work.txt	2014-03-10 14:26:20 +0000
@@ -0,0 +1,144 @@
+---Fields in module 'project'---
+project      / account.analytic.account / use_tasks (boolean)           : NEW 
+### -> New field to indicate to use tasks in the project. It can be default to False. (Nothing to do)
+
+project      / project.category         / name (char)                   : NEW required: required
+project      / project.task             / categ_ids (many2many)         : NEW relation: project.category
+### -> New complete model for categorizing tasks. It can be none category. (Nothing to do)
+
+project      / project.project          / state (selection)             : NEW required: required, selection_keys: ['cancelled', 'close', 'draft', 'open', 'pending', 'template'], req_default: open
+### -> This state field has been moved from analytic account to the project. Done.
+
+project      / project.task             / stage_id (many2one)           : NEW relation: project.task.type
+project      / project.task             / type_id (many2one)            : DEL relation: project.task.type
+### -> Column rename. Done.
+
+project      / project.task.type        / case_default (boolean)        : NEW 
+project      / project.task.type        / project_default (boolean)     : DEL 
+### -> Column rename. Done.
+
+project      / project.project          / warn_customer (boolean)       : DEL 
+project      / project.project          / warn_footer (text)            : DEL 
+project      / project.project          / warn_header (text)            : DEL 
+project      / project.project          / warn_manager (boolean)        : DEL 
+### -> #TODO: Deleted fields, difficult to translate to the new system. Rarely used.
+
+project      / project.task             / state (selection)             : now a function
+project      / project.task.type        / state (selection)             : NEW required: required, selection_keys: ['cancelled', 'done', 'draft', 'open', 'pending'], req_default: open
+### -> #TODO: State field has been added on the stage, and state field in task is define as a function.
+### -> It can be queried previous state from tasks and deduced state value for the stage.
+
+project      / project.project          / alias_id (many2one)           : NEW relation: mail.alias, required: required
+project      / project.project          / alias_model (selection)       : NEW required: required, selection_keys: function, req_default: project.task
+### -> Alias for mail messages. Force creation on migration. Done.
+
+project      / project.project          / color (integer)               : NEW 
+### -> Optional field for color projects. (Nothing to do)
+
+project      / project.project          / privacy_visibility (selection): NEW required: required, selection_keys: ['followers', 'public'], req_default: public
+### -> New required field with default. (Nothing to do)
+
+project      / project.task.history.cumulative / project_id (many2one)         : not a function anymore
+### -> Now a related field. (Nothing to do)
+
+project      / project.task.type        / fold (boolean)                : NEW 
+### -> Optional field. Default to False is OK. (Nothing to do)
+
+project      / report.project.task.user / type_id (many2one)            : DEL relation: project.task.type
+### -> Removed field in a table view. (Nothing to do)
+
+project      / res.users                / context_project_id (many2one) : DEL relation: project.project
+### -> Useless field removed. (Nothing to do)
+
+---XML records in module 'project'---
+NEW ir.actions.act_window: project.action_config_settings
+DEL ir.actions.act_window: project.act_my_account
+DEL ir.actions.act_window: project.act_my_project
+DEL ir.actions.act_window: project.act_res_users_2_project_project
+DEL ir.actions.act_window: project.action_create_initial_projects_installer
+DEL ir.actions.act_window: project.action_project_vs_remaining_hours_graph
+DEL ir.actions.act_window: project.action_review_task_stage
+DEL ir.actions.act_window: project.action_task_by_days_graph
+DEL ir.actions.act_window: project.action_view_delegate_task_tree
+DEL ir.actions.act_window: project.action_view_task_history_burndown
+DEL ir.actions.act_window: project.action_view_task_tree_deadline
+DEL ir.actions.act_window.view: project.open_view_project_vs_remaining_hours_graph
+DEL ir.actions.act_window.view: project.open_view_project_vs_remaining_hours_tree
+NEW ir.actions.client: project.action_client_project_menu
+### -> Deleted and added window and client actions. (Nothing to do)
+
+NEW ir.actions.todo: base.open_menu
+DEL ir.actions.todo: project.config_wizard_action_create_initial_projects_installer
+DEL ir.actions.todo: project.config_wizard_action_review_task_stage
+DEL ir.actions.todo.category: project.category_project_config
+### -> Changed configuration wizards. (Nothing to do)
+
+NEW ir.model.access: project.access_account_analytic_account_user
+NEW ir.model.access: project.access_project_category
+NEW ir.model.access: project.access_project_category_manager
+NEW ir.model.access: project.access_project_project_manager
+NEW ir.model.access: project.access_project_task_history_sale_user
+NEW ir.model.access: project.access_project_task_type_sale_user
+DEL ir.model.access: project.access_mail_message_project_user
+DEL ir.model.access: project.access_partner_address_task user
+DEL ir.model.access: project.access_project_vs_hours
+DEL ir.model.access: project.access_task_by_days
+NEW ir.rule: project.project_public_members_rule
+### -> Changed security rules. (Nothing to do)
+
+NEW ir.ui.menu: base.menu_definitions
+NEW ir.ui.menu: base.menu_project_config
+NEW ir.ui.menu: base.menu_project_config_project
+NEW ir.ui.menu: project.menu_project_dashboard
+NEW ir.ui.menu: project.menu_projects
+DEL ir.ui.menu: project.menu_action_view_task_history_burndown
+DEL ir.ui.menu: project.menu_board_project
+DEL ir.ui.menu: project.menu_definitions
+DEL ir.ui.menu: project.menu_open_view_project_all
+DEL ir.ui.menu: project.menu_project_config_project
+DEL ir.ui.menu: project.next_id_86
+DEL ir.ui.menu: project.project_report_task
+### -> Changed menus. (Nothing to do)
+
+NEW ir.ui.view: project.analytic_account_inherited_form
+NEW ir.ui.view: project.view_config_settings
+NEW ir.ui.view: project.view_project_kanban
+DEL ir.ui.view: base.view_crm_partner_info_History
+DEL ir.ui.view: project.view_delegated_task_tree
+DEL ir.ui.view: project.view_project_users_form_simple
+DEL ir.ui.view: project.view_project_vs_planned_total_hours_graph
+DEL ir.ui.view: project.view_project_vs_planned_total_hours_tree
+DEL ir.ui.view: project.view_project_vs_remaining_hours_graph
+DEL ir.ui.view: project.view_project_vs_remaining_hours_tree
+DEL ir.ui.view: project.view_task_by_days_graph
+DEL ir.ui.view: project.view_task_by_days_tree
+DEL ir.ui.view: project.view_task_history_burndown_graph
+DEL ir.ui.view: project.view_users_form_project_modif_inherited1
+### -> Changed views. (Nothing to do)
+
+NEW mail.message: project.module_install_notification
+NEW mail.message.subtype: project.mt_project_task_blocked
+NEW mail.message.subtype: project.mt_project_task_closed
+NEW mail.message.subtype: project.mt_project_task_new
+NEW mail.message.subtype: project.mt_project_task_stage
+NEW mail.message.subtype: project.mt_project_task_started
+NEW mail.message.subtype: project.mt_task_blocked
+NEW mail.message.subtype: project.mt_task_closed
+NEW mail.message.subtype: project.mt_task_new
+NEW mail.message.subtype: project.mt_task_stage
+NEW mail.message.subtype: project.mt_task_started
+### -> Chatter functions. (Nothing to do)
+
+NEW project.task.type: project.project_tt_analysis
+NEW project.task.type: project.project_tt_cancel
+NEW project.task.type: project.project_tt_deployment
+NEW project.task.type: project.project_tt_design
+### -> New task stages. (Nothing to do)
+
+NEW res.company: base.main_company
+### -> Company alias. (Nothing to do)
+
+NEW res.groups: project.group_delegate_task
+NEW res.groups: project.group_tasks_work_on_tasks
+NEW res.groups: project.group_time_work_estimation_tasks
+### -> New security groups. (Nothing to do)

=== added file 'project/migrations/7.0.1.1/post-migration.py'
--- project/migrations/7.0.1.1/post-migration.py	1970-01-01 00:00:00 +0000
+++ project/migrations/7.0.1.1/post-migration.py	2014-03-10 14:26:20 +0000
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This migration script copyright (C) 2014
+# Pedro M. Baeza (pedro.baeza@xxxxxxxxxxxxxxxxxx)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openupgrade import openupgrade
+from openerp import pooler, SUPERUSER_ID
+
+def copy_state_from_analytic_account(cr):
+    openupgrade.logged_query(cr, """
+        UPDATE project_project
+        SET state = (
+            SELECT %s
+            FROM account_analytic_account
+            WHERE account_analytic_account.id = project_project.analytic_account_id
+        )
+        WHERE analytic_account_id is not NULL
+        """ %(openupgrade.get_legacy_name('state')))
+
+def short_name(name):
+    """Keep first word(s) of name to make it small enough
+       but distinctive"""
+    if not name: return name
+    # keep 7 chars + end of the last word
+    keep_words = name[:7].strip().split()
+    return ' '.join(name.split()[:len(keep_words)])
+
+def createProjectAliases(cr, pool):
+    alias_obj = pool.get('mail.alias')
+    project_obj = pool.get('project.project')
+    cr.execute("""
+    SELECT project_project.id, account_analytic_account.name
+    FROM project_project, account_analytic_account
+    WHERE account_analytic_account.name is not NULL
+    AND project_project.alias_id is NULL
+    AND project_project.analytic_account_id = account_analytic_account.id
+    """)
+    for (id, name) in cr.fetchall():
+        alias_id = alias_obj.create_unique_alias(cr, SUPERUSER_ID,
+                              {'alias_name': "project+" + short_name(name)},
+                              model_name='project.task')
+        cr.execute("""
+            UPDATE project_project
+            SET alias_id=%s
+            WHERE id=%s
+            """, (alias_id, id))
+
+@openupgrade.migrate()
+def migrate(cr, version):
+    if not version:
+        return
+    pool = pooler.get_pool(cr.dbname)
+    copy_state_from_analytic_account(cr)
+    createProjectAliases(cr, pool)
+    openupgrade.logged_query(cr,'DROP VIEW project_vs_hours')
\ No newline at end of file

=== added file 'project/migrations/7.0.1.1/pre-migration.py'
--- project/migrations/7.0.1.1/pre-migration.py	1970-01-01 00:00:00 +0000
+++ project/migrations/7.0.1.1/pre-migration.py	2014-03-10 14:26:20 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This migration script copyright (C) 2014
+# Pedro M. Baeza (pedro.baeza@xxxxxxxxxxxxxxxxxx)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openupgrade import openupgrade
+
+column_renames = {
+    'account_analytic_account':[
+        ('state', None),
+    ],
+    'project_task':[
+        ('type_id', 'stage_id'),
+    ],
+    'project_task_type':[
+        ('project_default', 'case_default'),
+    ],
+}
+
+@openupgrade.migrate()
+def migrate(cr, version):
+    if not version:
+        return
+    openupgrade.rename_columns(cr, column_renames)
\ No newline at end of file

=== added file 'project/migrations/7.0.1.1/user_notes.txt'
--- project/migrations/7.0.1.1/user_notes.txt	1970-01-01 00:00:00 +0000
+++ project/migrations/7.0.1.1/user_notes.txt	2014-03-10 14:26:20 +0000
@@ -0,0 +1,11 @@
+********************************************************************************
+1/ If you have defined custom project stages (project.task.type), related state
+will be set default to open, and related task will have this state. If you
+want to set them to another state, you will have to do it manually.
+
+2/ Project warning messages when you close tasks are lost in the migration,
+because they are not easily translated to the new system, so you will have to
+rewrite them on v7.
+
+3/ All projects are set by default to public visibility. Change manually
+on each project accordingly new possibilities and your needs.


Follow ups