credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #05480
[Merge] lp:~sylvain-legal/openupgrade-addons/7.0-hr into lp:openupgrade-addons
Sylvain LE GAL (GRAP) has proposed merging lp:~sylvain-legal/openupgrade-addons/7.0-hr into lp:openupgrade-addons.
Requested reviews:
OpenUpgrade Committers (openupgrade-committers)
For more details, see:
https://code.launchpad.net/~sylvain-legal/openupgrade-addons/7.0-hr/+merge/186380
--
https://code.launchpad.net/~sylvain-legal/openupgrade-addons/7.0-hr/+merge/186380
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~sylvain-legal/openupgrade-addons/7.0-hr into lp:openupgrade-addons.
=== added file 'hr/migrations/7.0.1.1/openupgrade_analysis_work.txt'
--- hr/migrations/7.0.1.1/openupgrade_analysis_work.txt 1970-01-01 00:00:00 +0000
+++ hr/migrations/7.0.1.1/openupgrade_analysis_work.txt 2013-09-18 16:11:42 +0000
@@ -0,0 +1,64 @@
+---Fields in module 'hr'---
+# Migration script will use 'set_partner_id_from_partner_address_id' to change model. OK.
+hr / hr.employee / address_home_id (many2one) : relation is now 'res.partner' ('res.partner.address')
+
+# Migration script will use 'set_partner_id_from_partner_address_id' to change model. OK.
+hr / hr.employee / address_id (many2one) : relation is now 'res.partner' ('res.partner.address')
+
+### in 'hr.employee' model, 'photo' has been renamed in 'image'. OK.
+hr / hr.employee / photo (binary) : DEL
+hr / hr.employee / image (binary) : NEW
+
+### Ignore, no existing data to push as messages
+hr / hr.job / message_ids (one2many) : NEW relation: mail.message
+
+### Change in keys :
+# DEL KEYS : ('old').
+# Script migration will change 'old' state in 'open' state.
+# There is no problem, because there isn't workflow associated. OK.
+hr / hr.job / state (selection) : selection_keys is now '['open', 'recruit']' ('['old', 'open', 'recruit']')
+
+
+# In 6.1, hr.department was in res.users and hr_employee.
+# In 7.0, there isn't relation between res.users and hr.department.
+# Migration choice : we'll put in hr_employee they don't have hr_department, the department of the associated user. (if any) OK.
+hr / res.users / context_department_id (many2one): DEL relation: hr.department
+
+### New one2many fields in 'res.users' model. Nothing to do.
+hr / res.users / employee_ids (one2many) : NEW relation: hr.employee
+
+
+---XML records in module 'hr'---
+### Ignore interface and access records
+NEW ir.actions.act_window: hr.action_human_resources_configuration
+NEW ir.actions.act_window: hr.open_payroll_modules
+DEL ir.actions.act_window: hr.action_create_hr_employee_installer
+DEL ir.actions.act_window: hr.open_board_hr_manager
+DEL ir.actions.act_window: hr.open_view_categ_tree
+DEL ir.actions.act_window.view: hr.open_view_employee_list_my_form2
+DEL ir.actions.act_window.view: hr.open_view_employee_list_my_kanban
+DEL ir.actions.act_window.view: hr.open_view_employee_list_my_tree2
+NEW ir.actions.client: hr.action_client_hr_menu
+NEW ir.actions.todo: base.open_menu
+DEL ir.actions.todo: hr.config_wizard_action_create_hr_employee_installer
+DEL ir.actions.todo: hr.view_department_form_todo
+DEL ir.actions.todo.category: hr.category_hr_management_config
+DEL ir.model.access: hr.access_hr_res_partner_address
+NEW ir.ui.menu: hr.menu_hr_reporting_timesheet
+NEW ir.ui.menu: hr.menu_human_resources_configuration
+DEL ir.ui.menu: hr.menu_hr_dashboard_manager
+DEL ir.ui.menu: hr.menu_hr_dashboard_user
+DEL ir.ui.menu: hr.menu_hr_management
+DEL ir.ui.menu: hr.menu_view_employee_category_configuration_form
+DEL ir.ui.menu: hr.menu_view_employee_category_tree
+NEW ir.ui.view: hr.view_hr_job_employee_form
+NEW ir.ui.view: hr.view_human_resources_configuration
+DEL ir.ui.view: hr.board_hr_manager_form
+DEL ir.ui.view: hr.view_department_form_simple_modif_inherited1
+DEL ir.ui.view: hr.view_users_form_inherit
+
+### Ignore added chatter configuration
+NEW mail.message: hr.module_install_notification
+
+### Ignore new groups configuration
+NEW res.groups: base.group_user
=== added file 'hr/migrations/7.0.1.1/post-migration.py'
--- hr/migrations/7.0.1.1/post-migration.py 1970-01-01 00:00:00 +0000
+++ hr/migrations/7.0.1.1/post-migration.py 2013-09-18 16:11:42 +0000
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2013 Sylvain LE GAL
+#
+# 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, openupgrade_70
+from openerp import pooler, SUPERUSER_ID
+
+def migrate_hr_employee_addresses(cr, pool):
+ """
+ Change reference to old res_partner_address to new res_partner
+ """
+ # 'address_home_id' is now a 'res.partner' object
+ openupgrade_70.set_partner_id_from_partner_address_id(
+ cr, pool, 'hr.employee',
+ 'address_home_id', openupgrade.get_legacy_name('address_home_id'))
+ # 'address_id' is now a 'res.partner' object
+ openupgrade_70.set_partner_id_from_partner_address_id(
+ cr, pool, 'hr.employee',
+ 'address_id', openupgrade.get_legacy_name('address_id'))
+
+def migrate_hr_employee_department(cr, pool):
+ """
+ Update 'hr_employee.department_id' with value from deleted res_users.context_department_id.
+ """
+ hr_employee_obj = pool.get('hr.employee')
+ cr.execute("""
+ SELECT
+ hr_emp.id as hr_emp_id,
+ res_users.context_department_id as dep_id
+ FROM hr_employee hr_emp
+ INNER JOIN resource_resource res_res ON hr_emp.resource_id = res_res.id
+ INNER JOIN res_users ON res_res.user_id = res_users.id
+ WHERE hr_emp.department_id is null
+ AND NOT res_users.context_department_id is null""")
+ for (hr_emp_id, dep_id) in cr.fetchall():
+ vals = {
+ 'department_id': dep_id,
+ }
+ hr_employee_obj.write(cr, SUPERUSER_ID, hr_emp_id, vals)
+
+def migrate_hr_job(cr):
+ """
+ Change obsolete selection values for hr_job.state
+ """
+ openupgrade.logged_query(
+ cr, "UPDATE hr_job SET state = 'open' WHERE state = 'old' ")
+
+@openupgrade.migrate()
+def migrate(cr, version):
+ pool = pooler.get_pool(cr.dbname)
+ migrate_hr_employee_addresses(cr, pool)
+ migrate_hr_employee_department(cr, pool)
+ migrate_hr_job(cr)
=== added file 'hr/migrations/7.0.1.1/pre-migration.py'
--- hr/migrations/7.0.1.1/pre-migration.py 1970-01-01 00:00:00 +0000
+++ hr/migrations/7.0.1.1/pre-migration.py 2013-09-18 16:11:42 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2013 Sylvain LE GAL
+#
+# 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_employee': [
+ ('address_home_id', None),
+ ('address_id', None),
+ ('photo', 'image'),
+ ]
+}
+
+@openupgrade.migrate()
+def migrate(cr, version):
+ openupgrade.rename_columns(cr, column_renames)
Follow ups