Merge lp:~therp-nl/openupgrade-addons/6.0-lp1023798-do_not_rename_hr_employee__parent_id into lp:openupgrade-addons/6.0

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 4785
Proposed branch: lp:~therp-nl/openupgrade-addons/6.0-lp1023798-do_not_rename_hr_employee__parent_id
Merge into: lp:openupgrade-addons/6.0
Diff against target: 50 lines (+13/-1)
3 files modified
hr/migrations/6.0.1.1/post-migration.py (+10/-0)
hr/migrations/6.0.1.1/pre-migration.py (+1/-1)
hr/migrations/6.0.1.1/user_notes.txt (+2/-0)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-addons/6.0-lp1023798-do_not_rename_hr_employee__parent_id
Reviewer Review Type Date Requested Status
Don Kirkby (community) Approve
OpenUpgrade Committers Pending
Review via email: mp+115698@code.launchpad.net

Description of the change

This branch restores the manually assigned employees' managers. I could not simply *not* rename the table, as other changes require the department_id to be written on the employee record. This triggers that the department_id's head is written as the manager on the employee record due to it being a stored related field (a change that was reverted in OpenERP 6.1 which warrants restoring the manager field this way in the first place).

To post a comment you must log in.
Revision history for this message
Don Kirkby (donkirkby) wrote :

Looks good, thanks for the fix.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hr/migrations/6.0.1.1/post-migration.py'
--- hr/migrations/6.0.1.1/post-migration.py 2012-06-07 14:51:52 +0000
+++ hr/migrations/6.0.1.1/post-migration.py 2012-07-19 10:47:55 +0000
@@ -91,6 +91,11 @@
91 to membership by employee. 91 to membership by employee.
92 In OpenERP 6, an employee can only be in a single92 In OpenERP 6, an employee can only be in a single
93 department.93 department.
94
95 When the department is written on the employee record,
96 the manager is taken to be the head of the department in 6.0.
97 This change was reverted in 6.1. To accomodate migrations to 6.1,
98 restore the original manager
94 """99 """
95 employee_pool = pool.get('hr.employee')100 employee_pool = pool.get('hr.employee')
96 cr.execute("""101 cr.execute("""
@@ -116,6 +121,11 @@
116 employee_pool.write(121 employee_pool.write(
117 cr, 1, employee_id, {'department_id': row[1]})122 cr, 1, employee_id, {'department_id': row[1]})
118123
124 openupgrade.logged_query(cr, """
125 UPDATE hr_employee
126 SET parent_id = %s
127 """ % openupgrade.get_legacy_name('parent_id'))
128
119def set_marital(cr, pool):129def set_marital(cr, pool):
120 """130 """
121 Migrate selection field 'marital' to131 Migrate selection field 'marital' to
122132
=== modified file 'hr/migrations/6.0.1.1/pre-migration.py'
--- hr/migrations/6.0.1.1/pre-migration.py 2012-06-07 14:51:52 +0000
+++ hr/migrations/6.0.1.1/pre-migration.py 2012-07-19 10:47:55 +0000
@@ -34,7 +34,7 @@
34 ('company_id', 'openupgrade_legacy_company_id'),34 ('company_id', 'openupgrade_legacy_company_id'),
35 ('category_id', 'openupgrade_legacy_category_id'),35 ('category_id', 'openupgrade_legacy_category_id'),
36 ('marital', 'openupgrade_legacy_marital'),36 ('marital', 'openupgrade_legacy_marital'),
37 ('parent_id', 'openupgrade_legacy_parent_id'),37 ('parent_id', openupgrade.get_legacy_name('parent_id')),
38 ]38 ]
39 }39 }
4040
4141
=== modified file 'hr/migrations/6.0.1.1/user_notes.txt'
--- hr/migrations/6.0.1.1/user_notes.txt 2012-05-21 15:35:12 +0000
+++ hr/migrations/6.0.1.1/user_notes.txt 2012-07-19 10:47:55 +0000
@@ -4,3 +4,5 @@
4- An employee can now have multiple categories4- An employee can now have multiple categories
5- The employee model is integrated with the resource model5- The employee model is integrated with the resource model
6- Departments now have employees as their member type, not system users6- Departments now have employees as their member type, not system users
7
8Note that in 6.0, the employee's manager is derived from the head of the department but the field is not actually written until you assign a new department to an employee in OpenERP 6.0. As in 6.1 this change is reverted, this migrationtakes care to preserve the users' managers. If you migrate from 5.0 to 6.1 without actually using the system in OpenERP 6.0, you will be able to keep the originally assigned managers on the employee records.

Subscribers

People subscribed via source and target branches