Merge lp:~therp-nl/openupgrade-addons/6.1-hr into lp:openupgrade-addons/6.1

Proposed by Holger Brunn (Therp)
Status: Superseded
Proposed branch: lp:~therp-nl/openupgrade-addons/6.1-hr
Merge into: lp:openupgrade-addons/6.1
Diff against target: 274 lines (+123/-20)
21 files modified
account_analytic_analysis/migrations/6.1.1.1/user_notes.txt (+1/-0)
account_analytic_default/migrations/6.1.1.0/user_notes.txt (+1/-0)
account_analytic_plans/migrations/6.1.1.0/user_notes.txt (+1/-0)
account_budget/migrations/6.1.1.0/user_notes.txt (+1/-0)
analytic_user_function/migrations/6.1.1.0/user_notes.txt (+1/-0)
audittrail/migrations/6.1.1.0/user_notes.txt (+1/-0)
base_setup/migrations/6.1.1.0/user_notes.txt (+1/-0)
hr/migrations/6.1.1.1/post-migration.py (+51/-16)
hr/migrations/6.1.1.1/pre-migration.py (+3/-3)
hr/migrations/6.1.1.1/user_notes.txt (+1/-1)
hr_attendance/migrations/6.1.1.1/user_notes.txt (+1/-0)
hr_contract/migrations/6.1.1.0/pre-migrate.py (+14/-0)
hr_contract/migrations/6.1.1.0/user_notes.txt (+22/-0)
hr_expense/migrations/6.1.1.0/user_notes.txt (+1/-0)
hr_timesheet/migrations/6.1.1.0/user_notes.txt (+1/-0)
hr_timesheet_invoice/migrations/6.1.1.0/user_notes.txt (+1/-0)
hr_timesheet_sheet/migrations/6.1.1.0/pre-migrate.py (+15/-0)
hr_timesheet_sheet/migrations/6.1.1.0/user_notes.txt (+3/-0)
mrp/migrations/6.1.1.1/user_notes.txt (+1/-0)
project_timesheet/migrations/6.1.1.0/user_notes.txt (+1/-0)
purchase/migrations/6.1.1.1/user_notes.txt (+1/-0)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-addons/6.1-hr
Reviewer Review Type Date Requested Status
OpenUpgrade Committers Pending
Review via email: mp+109793@code.launchpad.net

This proposal supersedes a proposal from 2012-06-11.

This proposal has been superseded by a proposal from 2012-06-19.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'account_analytic_analysis/migrations/6.1.1.1/user_notes.txt'
2--- account_analytic_analysis/migrations/6.1.1.1/user_notes.txt 1970-01-01 00:00:00 +0000
3+++ account_analytic_analysis/migrations/6.1.1.1/user_notes.txt 2012-06-19 09:18:22 +0000
4@@ -0,0 +1,1 @@
5+Nothing to do for module 'account_analytic_analysis'
6
7=== added file 'account_analytic_default/migrations/6.1.1.0/user_notes.txt'
8--- account_analytic_default/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
9+++ account_analytic_default/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
10@@ -0,0 +1,1 @@
11+Nothing to do for module 'account_analytic_default'
12
13=== added file 'account_analytic_plans/migrations/6.1.1.0/user_notes.txt'
14--- account_analytic_plans/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
15+++ account_analytic_plans/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
16@@ -0,0 +1,1 @@
17+Nothing to do for module 'account_analytic_plans'
18
19=== added file 'account_budget/migrations/6.1.1.0/user_notes.txt'
20--- account_budget/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
21+++ account_budget/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
22@@ -0,0 +1,1 @@
23+Nothing to do for module 'account_budget'
24
25=== added file 'analytic_user_function/migrations/6.1.1.0/user_notes.txt'
26--- analytic_user_function/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
27+++ analytic_user_function/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
28@@ -0,0 +1,1 @@
29+Nothing to do for 'analytic_user_function'
30
31=== added file 'audittrail/migrations/6.1.1.0/user_notes.txt'
32--- audittrail/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
33+++ audittrail/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
34@@ -0,0 +1,1 @@
35+Nothing to do for module 'audittrail'
36
37=== added file 'base_setup/migrations/6.1.1.0/user_notes.txt'
38--- base_setup/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
39+++ base_setup/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
40@@ -0,0 +1,1 @@
41+Nothing to do for module 'base_setup'
42
43=== modified file 'hr/migrations/6.1.1.1/post-migration.py'
44--- hr/migrations/6.1.1.1/post-migration.py 2012-06-08 09:18:00 +0000
45+++ hr/migrations/6.1.1.1/post-migration.py 2012-06-19 09:18:22 +0000
46@@ -8,30 +8,65 @@
47 @openupgrade.migrate()
48 def migrate(cr, version):
49 pool = pooler.get_pool(cr.dbname)
50- #null values of the many2one are reset to first value in the selection, restore the null values
51- cr.execute('update hr_employee set marital=NULL where openupgrade_legacy_marital is NULL')
52- #get possible marital states and if in the original many2one, update selection field
53+ #null values of the many2one are reset to first value in the selection,
54+ #restore the null values
55+ cr.execute('update hr_employee set marital=NULL where '+
56+ openupgrade.get_legacy_name('marital')+' is NULL')
57+ #get possible marital states and if in the original many2one, update
58+ #selection field
59 marital_states={}
60- for (marital_state,marital_state_name) in pool.get('hr.employee')._columns['marital'].selection:
61+ for (marital_state,marital_state_name) in pool.get('hr.employee')._columns['marital'].selection:
62 cr.execute(
63- 'update hr_employee set marital=%(marital_state)s where openupgrade_legacy_marital in'+
64- '(select id from openupgrade_legacy_hr_employee_marital_status where lower(name) in %(marital_states)s)',
65- {'marital_state': marital_state, 'marital_states': tuple([marital_state.lower(),marital_state_name.lower()])})
66+ 'update hr_employee set marital=%(marital_state)s where '+
67+ openupgrade.get_legacy_name('marital')+' in'+
68+ '(select id from '+
69+ openupgrade.get_legacy_name('hr_employee_marital_status')+
70+ ' where lower(name) in %(marital_states)s)',
71+ {
72+ 'marital_state': marital_state,
73+ 'marital_states':
74+ tuple([marital_state.lower(),marital_state_name.lower()])
75+ })
76 marital_states[marital_state]=marital_state_name
77
78 #get marital states not included in the selection
79- cr.execute('select id from hr_employee where openupgrade_legacy_marital is not null and openupgrade_legacy_marital not in '+
80- '(select id from openupgrade_legacy_hr_employee_marital_status where lower(name) in %(marital_states)s)',
81- {'marital_states': tuple([v.lower() for v in marital_states.itervalues()]+[k.lower() for k in marital_states.iterkeys()])})
82+ cr.execute(
83+ 'select id from hr_employee where '+
84+ openupgrade.get_legacy_name('marital')+' is not null and '+
85+ openupgrade.get_legacy_name('marital')+' not in '+
86+ '(select id from '+
87+ openupgrade.get_legacy_name('hr_employee_marital_status')+
88+ ' where lower(name) in %(marital_states)s)',
89+ {
90+ 'marital_states':
91+ tuple(
92+ [v.lower() for v in marital_states.itervalues()]+
93+ [k.lower() for k in marital_states.iterkeys()])
94+ })
95 if cr.rowcount:
96- logger.warning('not all values of hr_employee_marital_status are in the selection. review hr_employee ids %s', [row[0] for row in cr.fetchall()])
97+ logger.warning('not all values of hr_employee_marital_status are in '+
98+ 'the selection. review hr_employee ids %s',
99+ [row[0] for row in cr.fetchall()])
100 else:
101 logger.info('all values of hr_employee_marital_status are in the selection')
102- openupgrade.drop_columns(cr, [('hr_employee', 'openupgrade_legacy_marital')])
103- cr.execute('drop table openupgrade_legacy_hr_employee_marital_status')
104+ openupgrade.drop_columns(
105+ cr,
106+ [('hr_employee',
107+ openupgrade.get_legacy_name('marital'))])
108+ cr.execute('drop table '+
109+ openupgrade.get_legacy_name('hr_employee_marital_status'))
110
111 #fields have been calculated already
112- cr.execute('update hr_job set no_of_recruitment=openupgrade_legacy_expected_employees-no_of_employee')
113+ cr.execute(
114+ 'update hr_job set no_of_recruitment='+
115+ openupgrade.get_legacy_name('expected_employees')+
116+ '-no_of_employee')
117 #recalculate expectred employees
118- cr.execute('update hr_job set expected_employees=no_of_recruitment+no_of_employee')
119- openupgrade.drop_columns(cr, [('hr_job', 'openupgrade_legacy_expected_employees')])
120+ cr.execute(
121+ 'update hr_job set expected_employees=no_of_recruitment+no_of_employee')
122+ openupgrade.drop_columns(
123+ cr,
124+ [(
125+ 'hr_job',
126+ openupgrade.get_legacy_name('expected_employees')
127+ )])
128
129=== modified file 'hr/migrations/6.1.1.1/pre-migration.py'
130--- hr/migrations/6.1.1.1/pre-migration.py 2012-06-07 13:13:15 +0000
131+++ hr/migrations/6.1.1.1/pre-migration.py 2012-06-19 09:18:22 +0000
132@@ -4,15 +4,15 @@
133
134 @openupgrade.migrate()
135 def migrate(cr, version):
136- openupgrade.rename_tables(cr, [('hr_employee_marital_status', 'openupgrade_legacy_hr_employee_marital_status')])
137+ openupgrade.rename_tables(cr, [('hr_employee_marital_status', openupgrade.get_legacy_name('hr_employee_marital_status'))])
138 openupgrade.rename_columns(cr,
139 {
140 'hr_employee':
141 [
142- ('marital', 'openupgrade_legacy_marital'),
143+ ('marital', openupgrade.get_legacy_name('marital')),
144 ],
145 'hr_job':
146 [
147- ('expected_employees', 'openupgrade_legacy_expected_employees')
148+ ('expected_employees', openupgrade.get_legacy_name('expected_employees'))
149 ],
150 })
151
152=== modified file 'hr/migrations/6.1.1.1/user_notes.txt'
153--- hr/migrations/6.1.1.1/user_notes.txt 2012-06-08 13:03:40 +0000
154+++ hr/migrations/6.1.1.1/user_notes.txt 2012-06-19 09:18:22 +0000
155@@ -1,2 +1,2 @@
156-Marital status has been changed (back) to be a selection. The script tries to find a suitable selection entry from the list of marital states. This will fail if you customized this list, you'll get a warning about the employee IDs with marital states not in the selection, and find the original values in column openupgrade_legacy_marital. If you customize the selection *before* the migration with the same values used in the list of martial states, this script will pick up those values too.
157+Marital status has been changed (back) to be a selection. The script tries to find a suitable selection entry from the list of marital states. This will fail if you customized this list, you'll get a warning about the employee IDs with marital states not in the selection, and find the original values in column openupgrade_6_1_1_1_legacy_marital. If you customize the selection *before* the migration with the same values used in the list of martial states, this script will pick up those values too.
158 If there are no unknown marital states (either because you didn't customize them or you put your customizations into the selection), the legacy column and the table will be dropped after migration.
159
160=== added file 'hr_attendance/migrations/6.1.1.1/user_notes.txt'
161--- hr_attendance/migrations/6.1.1.1/user_notes.txt 1970-01-01 00:00:00 +0000
162+++ hr_attendance/migrations/6.1.1.1/user_notes.txt 2012-06-19 09:18:22 +0000
163@@ -0,0 +1,1 @@
164+Nothing to do for module 'hr_attendance'
165
166=== added file 'hr_contract/migrations/6.1.1.0/pre-migrate.py'
167--- hr_contract/migrations/6.1.1.0/pre-migrate.py 1970-01-01 00:00:00 +0000
168+++ hr_contract/migrations/6.1.1.0/pre-migrate.py 2012-06-19 09:18:22 +0000
169@@ -0,0 +1,14 @@
170+# -*- coding: utf-8 -*-
171+from openerp.openupgrade import openupgrade
172+
173+#@openupgrade.migrate()
174+def migrate(cr, version):
175+ openupgrade.rename_columns(
176+ cr,
177+ {
178+ 'hr_contract':
179+ [
180+ ('advantages_gross', openupgrade.get_legacy_name('advantages_gross')),
181+ ('advantages_net', openupgrade.get_legacy_name('advantages_net'))
182+ ]
183+ })
184
185=== added file 'hr_contract/migrations/6.1.1.0/user_notes.txt'
186--- hr_contract/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
187+++ hr_contract/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
188@@ -0,0 +1,22 @@
189+hr.contract.wage.type and hr.contract.wage.type.period have been dropped and
190+incorporated into hr_payroll.
191+
192+These tables still exist in the database.
193+
194+In case you don't want to step over to hr_payroll, you might want to consider
195+hr_contract_legacy.
196+
197+Also gross and net advantages have been dropped and incorporated into hr_payroll.
198+
199+The values of those fields have been evacuated to
200+openupgrade_legacy_6_1_0_final_0_advantages_net
201+openupgrade_legacy_6_1_0_final_0_advantages_gross
202+
203+If you want to add them to the notes field, run following query:
204+---
205+update hr_contract set notes=
206+coalesce(notes||E'\n', '') || 'gross advantages: ' ||
207+coalesce(cast(openupgrade_legacy_6_1_0_final_0_advantages_gross as varchar), '')
208+|| E'\nnet advantages: ' ||
209+coalesce(cast(openupgrade_legacy_6_1_0_final_0_advantages_net as varchar), '');
210+---
211
212=== added file 'hr_expense/migrations/6.1.1.0/user_notes.txt'
213--- hr_expense/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
214+++ hr_expense/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
215@@ -0,0 +1,1 @@
216+Nothing to do for module 'hr_expense'
217
218=== added file 'hr_timesheet/migrations/6.1.1.0/user_notes.txt'
219--- hr_timesheet/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
220+++ hr_timesheet/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
221@@ -0,0 +1,1 @@
222+Nothing to do for module 'hr_timesheet'
223
224=== added file 'hr_timesheet_invoice/migrations/6.1.1.0/user_notes.txt'
225--- hr_timesheet_invoice/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
226+++ hr_timesheet_invoice/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
227@@ -0,0 +1,1 @@
228+Nothing to do for module 'hr_timesheet_invoice'
229
230=== added file 'hr_timesheet_sheet/migrations/6.1.1.0/pre-migrate.py'
231--- hr_timesheet_sheet/migrations/6.1.1.0/pre-migrate.py 1970-01-01 00:00:00 +0000
232+++ hr_timesheet_sheet/migrations/6.1.1.0/pre-migrate.py 2012-06-19 09:18:22 +0000
233@@ -0,0 +1,15 @@
234+import logging
235+from openerp.openupgrade import openupgrade
236+
237+logger = logging.getLogger('OpenUpgrade')
238+
239+@openupgrade.migrate()
240+def migrate(cr, version):
241+ cr.execute("""select id, timesheet_range, name from res_company where
242+ timesheet_range='year'""")
243+ for row in cr.fetchall():
244+ logger.warning('%s is configured for timesheet validation per year. '+
245+ 'This was deprecated so validation for %s is changed '+
246+ 'to monthly.', row[2], row[2])
247+ cr.execute("""update res_company set timesheet_range='month'
248+ where timesheet_range='year'""")
249
250=== added file 'hr_timesheet_sheet/migrations/6.1.1.0/user_notes.txt'
251--- hr_timesheet_sheet/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
252+++ hr_timesheet_sheet/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
253@@ -0,0 +1,3 @@
254+Timesheet validation per year had been dropped.
255+If you used validation per year, this will be changed to validation per month
256+and a warning will be issued.
257
258=== added file 'mrp/migrations/6.1.1.1/user_notes.txt'
259--- mrp/migrations/6.1.1.1/user_notes.txt 1970-01-01 00:00:00 +0000
260+++ mrp/migrations/6.1.1.1/user_notes.txt 2012-06-19 09:18:22 +0000
261@@ -0,0 +1,1 @@
262+Nothing to do for module 'mrp'
263
264=== added file 'project_timesheet/migrations/6.1.1.0/user_notes.txt'
265--- project_timesheet/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
266+++ project_timesheet/migrations/6.1.1.0/user_notes.txt 2012-06-19 09:18:22 +0000
267@@ -0,0 +1,1 @@
268+Nothing to do for module 'project_timesheet'
269
270=== added file 'purchase/migrations/6.1.1.1/user_notes.txt'
271--- purchase/migrations/6.1.1.1/user_notes.txt 1970-01-01 00:00:00 +0000
272+++ purchase/migrations/6.1.1.1/user_notes.txt 2012-06-19 09:18:22 +0000
273@@ -0,0 +1,1 @@
274+Nothing to do for module 'purchase'

Subscribers

People subscribed via source and target branches