Merge lp:~credativ/openupgrade-addons/7.0 into lp:openupgrade-addons

Proposed by Stefan Rijnhart (Opener)
Status: Work in progress
Proposed branch: lp:~credativ/openupgrade-addons/7.0
Merge into: lp:openupgrade-addons
Diff against target: 973 lines (+854/-0)
24 files modified
analytic/migrations/7.0.1.1/post-migration.py (+37/-0)
base_calendar/migrations/7.0.1.0/post-migration.py (+27/-0)
base_calendar/migrations/7.0.1.0/pre-migration.py (+42/-0)
crm/migrations/7.0.1.0/post-migration.py (+39/-0)
crm/migrations/7.0.1.0/pre-migration.py (+33/-0)
delivery/migrations/7.0.1.0/post-migration.py (+38/-0)
document_ftp/migrations/7.0.1.99/pre-migration.py (+29/-0)
event/migrations/7.0.0.1/post-migration.py (+31/-0)
event/migrations/7.0.0.1/pre-migration.py (+32/-0)
hr/migrations/7.0.1.1/post-migration.py (+28/-0)
hr/migrations/7.0.1.1/pre-migration.py (+39/-0)
hr_holidays/migrations/7.0.1.5/pre-migration.py (+30/-0)
mail/migrations/7.0.1.0/post-migration.py (+64/-0)
mail/migrations/7.0.1.0/pre-migration.py (+50/-0)
product/migrations/7.0.1.1/pre-migration.py (+31/-0)
project/migrations/7.0.1.1/post-migration.py (+57/-0)
project/migrations/7.0.1.1/pre-migration.py (+33/-0)
project_issue/migrations/7.0.1.0/post-migration.py (+27/-0)
project_issue/migrations/7.0.1.0/pre-migration.py (+34/-0)
sale/migrations/7.0.1.0/post-migration.py (+29/-0)
sale_crm/migrations/7.0.1.0/post-migration.py (+27/-0)
sale_crm/migrations/7.0.1.0/pre-migration.py (+30/-0)
stock/migrations/7.0.1.1/post-migration.py (+37/-0)
stock/migrations/7.0.1.1/pre-migration.py (+30/-0)
To merge this branch: bzr merge lp:~credativ/openupgrade-addons/7.0
Reviewer Review Type Date Requested Status
OpenUpgrade Committers Pending
Review via email: mp+170411@code.launchpad.net

Description of the change

Please do not merge. This merge proposal is just for reference purposes. This work has been abandoned by its owner, but he offered to share it nevertheless. See https://lists.launchpad.net/openupgrade-drivers/msg00156.html

See also the server part at https://code.launchpad.net/~credativ/openupgrade-server/7.0/+merge/170414

If you are preparing parts of this code for merging into the project series, do not forget to attribute the author and copyright holder.

To post a comment you must log in.

Unmerged revisions

8140. By mistotebe

[IMP] Initial implementation for sale_crm module migration.

8139. By mistotebe

[IMP] Initial implementation for event module migration.

8138. By mistotebe

[IMP] Initial implementation for project_issue module migration.

8137. By mistotebe

[IMP] Initial implementation for delivery module migration.

8136. By mistotebe

[IMP] Initial implementation for sale module migration.

8135. By mistotebe

[IMP] Initial implementation for hr_holidays module migration.

8134. By mistotebe

[IMP] Initial implementation for stock module migration.

8133. By mistotebe

[IMP] Initial implementation for crm module migration.

8132. By mistotebe

[IMP] Initial implementation for project module migration.

8131. By mistotebe

[IMP] Initial implementation for hr module migration.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'analytic/migrations/7.0.1.1/post-migration.py'
2--- analytic/migrations/7.0.1.1/post-migration.py 1970-01-01 00:00:00 +0000
3+++ analytic/migrations/7.0.1.1/post-migration.py 2013-06-19 17:53:32 +0000
4@@ -0,0 +1,37 @@
5+# -*- coding: utf-8 -*-
6+##############################################################################
7+#
8+# OpenERP, Open Source Management Solution
9+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
10+#
11+# This program is free software: you can redistribute it and/or modify
12+# it under the terms of the GNU Affero General Public License as
13+# published by the Free Software Foundation, either version 3 of the
14+# License, or (at your option) any later version.
15+#
16+# This program is distributed in the hope that it will be useful,
17+# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+# GNU Affero General Public License for more details.
20+#
21+# You should have received a copy of the GNU Affero General Public License
22+# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+#
24+##############################################################################
25+
26+from openerp.openupgrade import openupgrade
27+import pooler
28+
29+_defaults = {
30+ # False results in column value NULL
31+ # None value triggers a call to the model's default function
32+ 'account.analytic.account' : [
33+ ('type', 'normal'),
34+ ],
35+ }
36+
37+@openupgrade.migrate()
38+def migrate(cr, version):
39+ pool = pooler.get_pool(cr.dbname)
40+ openupgrade.set_defaults(cr, pool, _defaults)
41+ #TODO: move contact_id to manager_id?
42
43=== added file 'base_calendar/migrations/7.0.1.0/post-migration.py'
44--- base_calendar/migrations/7.0.1.0/post-migration.py 1970-01-01 00:00:00 +0000
45+++ base_calendar/migrations/7.0.1.0/post-migration.py 2013-06-19 17:53:32 +0000
46@@ -0,0 +1,27 @@
47+# -*- coding: utf-8 -*-
48+##############################################################################
49+#
50+# OpenERP, Open Source Management Solution
51+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
52+#
53+# This program is free software: you can redistribute it and/or modify
54+# it under the terms of the GNU Affero General Public License as
55+# published by the Free Software Foundation, either version 3 of the
56+# License, or (at your option) any later version.
57+#
58+# This program is distributed in the hope that it will be useful,
59+# but WITHOUT ANY WARRANTY; without even the implied warranty of
60+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61+# GNU Affero General Public License for more details.
62+#
63+# You should have received a copy of the GNU Affero General Public License
64+# along with this program. If not, see <http://www.gnu.org/licenses/>.
65+#
66+##############################################################################
67+
68+from openupgrade import openupgrade
69+from openupgrade.openupgrade70 import partner_address_to_partner
70+
71+@openupgrade.migrate()
72+def migrate(cr, version):
73+ partner_address_to_partner(cr, 'calendar_attendee', 'partner_id')
74
75=== added file 'base_calendar/migrations/7.0.1.0/pre-migration.py'
76--- base_calendar/migrations/7.0.1.0/pre-migration.py 1970-01-01 00:00:00 +0000
77+++ base_calendar/migrations/7.0.1.0/pre-migration.py 2013-06-19 17:53:32 +0000
78@@ -0,0 +1,42 @@
79+# -*- coding: utf-8 -*-
80+##############################################################################
81+#
82+# OpenERP, Open Source Management Solution
83+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
84+#
85+# This program is free software: you can redistribute it and/or modify
86+# it under the terms of the GNU Affero General Public License as
87+# published by the Free Software Foundation, either version 3 of the
88+# License, or (at your option) any later version.
89+#
90+# This program is distributed in the hope that it will be useful,
91+# but WITHOUT ANY WARRANTY; without even the implied warranty of
92+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93+# GNU Affero General Public License for more details.
94+#
95+# You should have received a copy of the GNU Affero General Public License
96+# along with this program. If not, see <http://www.gnu.org/licenses/>.
97+#
98+##############################################################################
99+
100+from openerp.openupgrade import openupgrade
101+import logging
102+
103+renames = {
104+ 'calendar_attendee': [
105+ ('partner_address_id', 'partner_id'),
106+ ],
107+ 'calendar_event': [
108+ ('recurrent_id', 'recurrent_id_date'),
109+ ('recurrent_uid', 'recurrent_id'),
110+ ],
111+ 'calendar_todo': [
112+ ('recurrent_id', 'recurrent_id_date'),
113+ ('recurrent_uid', 'recurrent_id'),
114+ ],
115+ }
116+
117+
118+@openupgrade.migrate()
119+def migrate(cr, version):
120+ openupgrade.rename_columns(cr, renames)
121
122=== added file 'crm/migrations/7.0.1.0/post-migration.py'
123--- crm/migrations/7.0.1.0/post-migration.py 1970-01-01 00:00:00 +0000
124+++ crm/migrations/7.0.1.0/post-migration.py 2013-06-19 17:53:32 +0000
125@@ -0,0 +1,39 @@
126+# -*- coding: utf-8 -*-
127+##############################################################################
128+#
129+# OpenERP, Open Source Management Solution
130+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
131+#
132+# This program is free software: you can redistribute it and/or modify
133+# it under the terms of the GNU Affero General Public License as
134+# published by the Free Software Foundation, either version 3 of the
135+# License, or (at your option) any later version.
136+#
137+# This program is distributed in the hope that it will be useful,
138+# but WITHOUT ANY WARRANTY; without even the implied warranty of
139+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
140+# GNU Affero General Public License for more details.
141+#
142+# You should have received a copy of the GNU Affero General Public License
143+# along with this program. If not, see <http://www.gnu.org/licenses/>.
144+#
145+##############################################################################
146+
147+from openerp.openupgrade import openupgrade
148+
149+_defaults = {
150+ # False results in column value NULL
151+ # None value triggers a call to the model's default function
152+ 'crm.case.stage': [
153+ ('state', 'open'),
154+ ('type', 'both'),
155+ ],
156+ }
157+
158+@openupgrade.migrate()
159+def migrate(cr, version):
160+ pool = pooler.get_pool(cr.dbname)
161+ openupgrade.set_defaults(cr, pool, _defaults)
162+
163+ model = pool.get('res.partner')
164+ many2one2many2many(cr, model, 'res_partner', 'meeting_ids')
165
166=== added file 'crm/migrations/7.0.1.0/pre-migration.py'
167--- crm/migrations/7.0.1.0/pre-migration.py 1970-01-01 00:00:00 +0000
168+++ crm/migrations/7.0.1.0/pre-migration.py 2013-06-19 17:53:32 +0000
169@@ -0,0 +1,33 @@
170+# -*- coding: utf-8 -*-
171+##############################################################################
172+#
173+# OpenERP, Open Source Management Solution
174+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
175+#
176+# This program is free software: you can redistribute it and/or modify
177+# it under the terms of the GNU Affero General Public License as
178+# published by the Free Software Foundation, either version 3 of the
179+# License, or (at your option) any later version.
180+#
181+# This program is distributed in the hope that it will be useful,
182+# but WITHOUT ANY WARRANTY; without even the implied warranty of
183+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184+# GNU Affero General Public License for more details.
185+#
186+# You should have received a copy of the GNU Affero General Public License
187+# along with this program. If not, see <http://www.gnu.org/licenses/>.
188+#
189+##############################################################################
190+
191+from openerp.openupgrade import openupgrade
192+
193+@openupgrade.migrate()
194+def migrate(cr, version):
195+ openupgrade.rename_columns(cr, {
196+ 'crm_lead': [
197+ ('optout', 'opt_out'),
198+ ],
199+ 'res.partner': [
200+ ('meeting_ids', openupgrade.get_legacy_name('meeting_ids')),
201+ ],
202+ })
203
204=== added file 'delivery/migrations/7.0.1.0/post-migration.py'
205--- delivery/migrations/7.0.1.0/post-migration.py 1970-01-01 00:00:00 +0000
206+++ delivery/migrations/7.0.1.0/post-migration.py 2013-06-19 17:53:32 +0000
207@@ -0,0 +1,38 @@
208+# -*- coding: utf-8 -*-
209+##############################################################################
210+#
211+# OpenERP, Open Source Management Solution
212+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
213+#
214+# This program is free software: you can redistribute it and/or modify
215+# it under the terms of the GNU Affero General Public License as
216+# published by the Free Software Foundation, either version 3 of the
217+# License, or (at your option) any later version.
218+#
219+# This program is distributed in the hope that it will be useful,
220+# but WITHOUT ANY WARRANTY; without even the implied warranty of
221+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
222+# GNU Affero General Public License for more details.
223+#
224+# You should have received a copy of the GNU Affero General Public License
225+# along with this program. If not, see <http://www.gnu.org/licenses/>.
226+#
227+##############################################################################
228+
229+from openerp.openupgrade import openupgrade
230+
231+_defaults = {
232+ # False results in column value NULL
233+ # None value triggers a call to the model's default function
234+ 'stock.move': [
235+ ('weight_uom_id', None),
236+ ],
237+ 'stock.picking': [
238+ ('weight_uom_id', None),
239+ ],
240+ }
241+
242+@openupgrade.migrate()
243+def migrate(cr, version):
244+ pool = pooler.get_pool(cr.dbname)
245+ openupgrade.set_defaults(cr, pool, _defaults)
246
247=== added file 'document_ftp/migrations/7.0.1.99/pre-migration.py'
248--- document_ftp/migrations/7.0.1.99/pre-migration.py 1970-01-01 00:00:00 +0000
249+++ document_ftp/migrations/7.0.1.99/pre-migration.py 2013-06-19 17:53:32 +0000
250@@ -0,0 +1,29 @@
251+# -*- coding: utf-8 -*-
252+##############################################################################
253+#
254+# OpenERP, Open Source Management Solution
255+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
256+#
257+# This program is free software: you can redistribute it and/or modify
258+# it under the terms of the GNU Affero General Public License as
259+# published by the Free Software Foundation, either version 3 of the
260+# License, or (at your option) any later version.
261+#
262+# This program is distributed in the hope that it will be useful,
263+# but WITHOUT ANY WARRANTY; without even the implied warranty of
264+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
265+# GNU Affero General Public License for more details.
266+#
267+# You should have received a copy of the GNU Affero General Public License
268+# along with this program. If not, see <http://www.gnu.org/licenses/>.
269+#
270+##############################################################################
271+
272+from openerp.openupgrade import openupgrade
273+
274+def change_model(cr, xml_id, new_model):
275+ cr.execute("UPDATE ir_model_data SET model = %s WHERE name = %s", (new_model, xml_id))
276+
277+@openupgrade.migrate()
278+def migrate(cr, version):
279+ change_model(cr, 'action_document_browse', 'ir.actions.act_url')
280
281=== added file 'event/migrations/7.0.0.1/post-migration.py'
282--- event/migrations/7.0.0.1/post-migration.py 1970-01-01 00:00:00 +0000
283+++ event/migrations/7.0.0.1/post-migration.py 2013-06-19 17:53:32 +0000
284@@ -0,0 +1,31 @@
285+# -*- coding: utf-8 -*-
286+##############################################################################
287+#
288+# OpenERP, Open Source Management Solution
289+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
290+#
291+# This program is free software: you can redistribute it and/or modify
292+# it under the terms of the GNU Affero General Public License as
293+# published by the Free Software Foundation, either version 3 of the
294+# License, or (at your option) any later version.
295+#
296+# This program is distributed in the hope that it will be useful,
297+# but WITHOUT ANY WARRANTY; without even the implied warranty of
298+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
299+# GNU Affero General Public License for more details.
300+#
301+# You should have received a copy of the GNU Affero General Public License
302+# along with this program. If not, see <http://www.gnu.org/licenses/>.
303+#
304+##############################################################################
305+
306+from openupgrade import openupgrade
307+from openupgrade.openupgrade70 import partner_address_to_partner
308+
309+@openupgrade.migrate()
310+def migrate(cr, version):
311+ partner_address_to_partner(cr, 'event_event', 'address_id')
312+ cr.execute('UPDATE report_event_registration '\
313+ 'SET event_state = state, '\
314+ 'event_date = %s' % openupgrade.get_legacy_name('date'))
315+ #TODO: moving the mail data to mail.message and linking it here
316
317=== added file 'event/migrations/7.0.0.1/pre-migration.py'
318--- event/migrations/7.0.0.1/pre-migration.py 1970-01-01 00:00:00 +0000
319+++ event/migrations/7.0.0.1/pre-migration.py 2013-06-19 17:53:32 +0000
320@@ -0,0 +1,32 @@
321+# -*- coding: utf-8 -*-
322+##############################################################################
323+#
324+# OpenERP, Open Source Management Solution
325+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
326+#
327+# This program is free software: you can redistribute it and/or modify
328+# it under the terms of the GNU Affero General Public License as
329+# published by the Free Software Foundation, either version 3 of the
330+# License, or (at your option) any later version.
331+#
332+# This program is distributed in the hope that it will be useful,
333+# but WITHOUT ANY WARRANTY; without even the implied warranty of
334+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
335+# GNU Affero General Public License for more details.
336+#
337+# You should have received a copy of the GNU Affero General Public License
338+# along with this program. If not, see <http://www.gnu.org/licenses/>.
339+#
340+##############################################################################
341+
342+from openerp.openupgrade import openupgrade
343+
344+@openupgrade.migrate()
345+def migrate(cr, version):
346+ openupgrade.rename_columns(cr, {
347+ 'report_event_registration': [
348+ ('state', 'registration_state'),
349+ ('type', 'event_type'),
350+ ('date', openupgrade.get_legacy_name('date'))
351+ ],
352+ })
353
354=== added file 'hr/migrations/7.0.1.1/post-migration.py'
355--- hr/migrations/7.0.1.1/post-migration.py 1970-01-01 00:00:00 +0000
356+++ hr/migrations/7.0.1.1/post-migration.py 2013-06-19 17:53:32 +0000
357@@ -0,0 +1,28 @@
358+# -*- coding: utf-8 -*-
359+##############################################################################
360+#
361+# OpenERP, Open Source Management Solution
362+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
363+#
364+# This program is free software: you can redistribute it and/or modify
365+# it under the terms of the GNU Affero General Public License as
366+# published by the Free Software Foundation, either version 3 of the
367+# License, or (at your option) any later version.
368+#
369+# This program is distributed in the hope that it will be useful,
370+# but WITHOUT ANY WARRANTY; without even the implied warranty of
371+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
372+# GNU Affero General Public License for more details.
373+#
374+# You should have received a copy of the GNU Affero General Public License
375+# along with this program. If not, see <http://www.gnu.org/licenses/>.
376+#
377+##############################################################################
378+
379+from openupgrade import openupgrade
380+from openupgrade.openupgrade70 import partner_address_to_partner
381+
382+@openupgrade.migrate()
383+def migrate(cr, version):
384+ partner_address_to_partner(cr, 'hr_employee', 'address_id')
385+ partner_address_to_partner(cr, 'hr_employee', 'address_home_id')
386
387=== added file 'hr/migrations/7.0.1.1/pre-migration.py'
388--- hr/migrations/7.0.1.1/pre-migration.py 1970-01-01 00:00:00 +0000
389+++ hr/migrations/7.0.1.1/pre-migration.py 2013-06-19 17:53:32 +0000
390@@ -0,0 +1,39 @@
391+# -*- coding: utf-8 -*-
392+##############################################################################
393+#
394+# OpenERP, Open Source Management Solution
395+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
396+#
397+# This program is free software: you can redistribute it and/or modify
398+# it under the terms of the GNU Affero General Public License as
399+# published by the Free Software Foundation, either version 3 of the
400+# License, or (at your option) any later version.
401+#
402+# This program is distributed in the hope that it will be useful,
403+# but WITHOUT ANY WARRANTY; without even the implied warranty of
404+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
405+# GNU Affero General Public License for more details.
406+#
407+# You should have received a copy of the GNU Affero General Public License
408+# along with this program. If not, see <http://www.gnu.org/licenses/>.
409+#
410+##############################################################################
411+
412+from openerp.openupgrade import openupgrade
413+
414+def hr_job_state(cr):
415+ cr.execute(
416+ "UPDATE hr_job "\
417+ "SET state = 'open' "\
418+ "WHERE state = 'old'"
419+ )
420+
421+@openupgrade.migrate()
422+def migrate(cr, version):
423+ openupgrade.rename_columns(cr, {
424+ 'hr_employee': [
425+ ('photo', 'image'),
426+ ],
427+ })
428+ #TODO: what about the state=='old'?
429+ #hr_job_state(cr)
430
431=== added file 'hr_holidays/migrations/7.0.1.5/pre-migration.py'
432--- hr_holidays/migrations/7.0.1.5/pre-migration.py 1970-01-01 00:00:00 +0000
433+++ hr_holidays/migrations/7.0.1.5/pre-migration.py 2013-06-19 17:53:32 +0000
434@@ -0,0 +1,30 @@
435+# -*- coding: utf-8 -*-
436+##############################################################################
437+#
438+# OpenERP, Open Source Management Solution
439+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
440+#
441+# This program is free software: you can redistribute it and/or modify
442+# it under the terms of the GNU Affero General Public License as
443+# published by the Free Software Foundation, either version 3 of the
444+# License, or (at your option) any later version.
445+#
446+# This program is distributed in the hope that it will be useful,
447+# but WITHOUT ANY WARRANTY; without even the implied warranty of
448+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
449+# GNU Affero General Public License for more details.
450+#
451+# You should have received a copy of the GNU Affero General Public License
452+# along with this program. If not, see <http://www.gnu.org/licenses/>.
453+#
454+##############################################################################
455+
456+from openerp.openupgrade import openupgrade
457+
458+@openupgrade.migrate()
459+def migrate(cr, version):
460+ openupgrade.rename_columns(cr, {
461+ 'hr_holidays': [
462+ ('case_id', 'meeting_id'),
463+ ],
464+ })
465
466=== added file 'mail/migrations/7.0.1.0/post-migration.py'
467--- mail/migrations/7.0.1.0/post-migration.py 1970-01-01 00:00:00 +0000
468+++ mail/migrations/7.0.1.0/post-migration.py 2013-06-19 17:53:32 +0000
469@@ -0,0 +1,64 @@
470+# -*- coding: utf-8 -*-
471+##############################################################################
472+#
473+# OpenERP, Open Source Management Solution
474+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
475+#
476+# This program is free software: you can redistribute it and/or modify
477+# it under the terms of the GNU Affero General Public License as
478+# published by the Free Software Foundation, either version 3 of the
479+# License, or (at your option) any later version.
480+#
481+# This program is distributed in the hope that it will be useful,
482+# but WITHOUT ANY WARRANTY; without even the implied warranty of
483+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
484+# GNU Affero General Public License for more details.
485+#
486+# You should have received a copy of the GNU Affero General Public License
487+# along with this program. If not, see <http://www.gnu.org/licenses/>.
488+#
489+##############################################################################
490+
491+from osv import osv
492+import pooler, logging
493+from openerp.openupgrade import openupgrade
494+from openerp.tools.mail import html_sanitize, plaintext2html
495+
496+from openerp import SUPERUSER_ID
497+
498+me = __file__
499+_logger = logging.getLogger(__name__)
500+
501+subtype_mapping = {
502+ 'plain': (openupgrade.get_legacy_name('body_text'), plaintext2html),
503+ 'html': (openupgrade.get_legacy_name('body_html'), html_sanitize),
504+ }
505+
506+def convert_mail_bodies(cr, pool):
507+ msg_obj = pool.get('mail.message')
508+ _logger.info("%s: converting HTML messages", me)
509+ for subtype in subtype_mapping.keys():
510+ field, func = subtype_mapping[subtype]
511+ _logger.info("%s: converting %s messages", me, subtype)
512+ cr.execute("SELECT id, %(field)s FROM mail_message " \
513+ "WHERE %(msg_subtype)s = '%(subtype)s'" %
514+ {
515+ 'msg_subtype': openupgrade.get_legacy_name('subtype'),
516+ 'field': field,
517+ 'subtype': subtype,
518+ })
519+ for row in cr.fetchall():
520+ _logger.info("%s: message %s", me, row[0])
521+ body = func(row[1])
522+ cr.execute("UPDATE mail_message SET body = %s WHERE id = %s", body, row[0])
523+
524+
525+#@openupgrade.migrate()
526+def migrate(cr, version):
527+ try:
528+ #import ipdb; ipdb.set_trace()
529+ pool = pooler.get_pool(cr.dbname)
530+ convert_mail_bodies(cr, pool)
531+ #TODO: what about moving the messages to mail.mail and linking them?
532+ except Exception, e:
533+ raise osv.except_osv("OpenUpgrade", '%s: %s' % (me, e))
534
535=== added file 'mail/migrations/7.0.1.0/pre-migration.py'
536--- mail/migrations/7.0.1.0/pre-migration.py 1970-01-01 00:00:00 +0000
537+++ mail/migrations/7.0.1.0/pre-migration.py 2013-06-19 17:53:32 +0000
538@@ -0,0 +1,50 @@
539+# -*- coding: utf-8 -*-
540+##############################################################################
541+#
542+# OpenERP, Open Source Management Solution
543+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
544+#
545+# This program is free software: you can redistribute it and/or modify
546+# it under the terms of the GNU Affero General Public License as
547+# published by the Free Software Foundation, either version 3 of the
548+# License, or (at your option) any later version.
549+#
550+# This program is distributed in the hope that it will be useful,
551+# but WITHOUT ANY WARRANTY; without even the implied warranty of
552+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
553+# GNU Affero General Public License for more details.
554+#
555+# You should have received a copy of the GNU Affero General Public License
556+# along with this program. If not, see <http://www.gnu.org/licenses/>.
557+#
558+##############################################################################
559+
560+from openerp.openupgrade import openupgrade
561+import logging
562+
563+renames = {
564+ 'mail_message': [
565+ ('subtype', openupgrade.get_legacy_name('subtype')),
566+ ('body_html', openupgrade.get_legacy_name('body_html')),
567+ ('body_text', openupgrade.get_legacy_name('body_text')),
568+ ]
569+ }
570+
571+# there is a cyclic dependency in the module that cannot be handled without
572+# creating these columns first
573+def add_column(cr, column_spec):
574+ for table in column_spec.keys():
575+ for (name, typ) in column_spec[table]:
576+ cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (table, name, typ))
577+
578+@openupgrade.migrate()
579+def migrate(cr, version):
580+ openupgrade.rename_columns(cr, renames)
581+ add_column(cr, {
582+ 'res_users': [
583+ ('alias_id', 'INTEGER'),
584+ ],
585+ 'res_partner': [
586+ ('notification_email_send', 'char'),
587+ ],
588+ })
589
590=== added file 'product/migrations/7.0.1.1/pre-migration.py'
591--- product/migrations/7.0.1.1/pre-migration.py 1970-01-01 00:00:00 +0000
592+++ product/migrations/7.0.1.1/pre-migration.py 2013-06-19 17:53:32 +0000
593@@ -0,0 +1,31 @@
594+# -*- coding: utf-8 -*-
595+##############################################################################
596+#
597+# OpenERP, Open Source Management Solution
598+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
599+#
600+# This program is free software: you can redistribute it and/or modify
601+# it under the terms of the GNU Affero General Public License as
602+# published by the Free Software Foundation, either version 3 of the
603+# License, or (at your option) any later version.
604+#
605+# This program is distributed in the hope that it will be useful,
606+# but WITHOUT ANY WARRANTY; without even the implied warranty of
607+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
608+# GNU Affero General Public License for more details.
609+#
610+# You should have received a copy of the GNU Affero General Public License
611+# along with this program. If not, see <http://www.gnu.org/licenses/>.
612+#
613+##############################################################################
614+
615+from openerp.openupgrade import openupgrade
616+
617+@openupgrade.migrate()
618+def migrate(cr, version):
619+ openupgrade.rename_columns(cr, {
620+ 'product_product': [
621+ ('product_image', 'image'),
622+ ],
623+ })
624+ #TODO: what about moving selection = 'product'?
625
626=== added file 'project/migrations/7.0.1.1/post-migration.py'
627--- project/migrations/7.0.1.1/post-migration.py 1970-01-01 00:00:00 +0000
628+++ project/migrations/7.0.1.1/post-migration.py 2013-06-19 17:53:32 +0000
629@@ -0,0 +1,57 @@
630+# -*- coding: utf-8 -*-
631+##############################################################################
632+#
633+# OpenERP, Open Source Management Solution
634+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
635+#
636+# This program is free software: you can redistribute it and/or modify
637+# it under the terms of the GNU Affero General Public License as
638+# published by the Free Software Foundation, either version 3 of the
639+# License, or (at your option) any later version.
640+#
641+# This program is distributed in the hope that it will be useful,
642+# but WITHOUT ANY WARRANTY; without even the implied warranty of
643+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
644+# GNU Affero General Public License for more details.
645+#
646+# You should have received a copy of the GNU Affero General Public License
647+# along with this program. If not, see <http://www.gnu.org/licenses/>.
648+#
649+##############################################################################
650+
651+from openerp.openupgrade import openupgrade
652+
653+from openerp import SUPERUSER_ID
654+from openerp.addons.project.project import short_name
655+
656+_defaults = {
657+ # False results in column value NULL
658+ # None value triggers a call to the model's default function
659+ 'project.project': [
660+ ('name', 'unknown'),
661+ ('alias_model', 'project.task'),
662+ ('privacy_visibility', 'public'),
663+ ('state', 'open'),
664+ ],
665+ 'project.task.type': [
666+ ('state', 'open'),
667+ ],
668+ }
669+
670+def assign_mail_alias(cr, pool):
671+ mail_alias = pool.get('mail.alias')
672+
673+ projects = pool.get("project.project")
674+ project_ids = projects.search(cr, SUPERUSER_ID, [])
675+
676+ for project in projects.browse(cr, SUPERUSER_ID, project_ids):
677+ alias_id = mail_alias.create_unique_alias(cr, SUPERUSER_ID,
678+ {'alias_name': "project+project" + short_name(project.name)},
679+ model_name=project.alias_model)
680+ projects.write(cr, SUPERUSER_ID, [project['id']], {'alias_id': alias_id})
681+
682+@openupgrade.migrate()
683+def migrate(cr, version):
684+ pool = pooler.get_pool(cr.dbname)
685+ openupgrade.set_defaults(cr, pool, _defaults)
686+ assign_mail_alias(cr, pool)
687
688=== added file 'project/migrations/7.0.1.1/pre-migration.py'
689--- project/migrations/7.0.1.1/pre-migration.py 1970-01-01 00:00:00 +0000
690+++ project/migrations/7.0.1.1/pre-migration.py 2013-06-19 17:53:32 +0000
691@@ -0,0 +1,33 @@
692+# -*- coding: utf-8 -*-
693+##############################################################################
694+#
695+# OpenERP, Open Source Management Solution
696+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
697+#
698+# This program is free software: you can redistribute it and/or modify
699+# it under the terms of the GNU Affero General Public License as
700+# published by the Free Software Foundation, either version 3 of the
701+# License, or (at your option) any later version.
702+#
703+# This program is distributed in the hope that it will be useful,
704+# but WITHOUT ANY WARRANTY; without even the implied warranty of
705+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
706+# GNU Affero General Public License for more details.
707+#
708+# You should have received a copy of the GNU Affero General Public License
709+# along with this program. If not, see <http://www.gnu.org/licenses/>.
710+#
711+##############################################################################
712+
713+from openerp.openupgrade import openupgrade
714+
715+@openupgrade.migrate()
716+def migrate(cr, version):
717+ openupgrade.rename_columns(cr, {
718+ 'project_task': [
719+ ('type_id', 'stage_id'),
720+ ],
721+ 'project_task_type': [
722+ ('project_default', 'case_default'),
723+ ],
724+ })
725
726=== added file 'project_issue/migrations/7.0.1.0/post-migration.py'
727--- project_issue/migrations/7.0.1.0/post-migration.py 1970-01-01 00:00:00 +0000
728+++ project_issue/migrations/7.0.1.0/post-migration.py 2013-06-19 17:53:32 +0000
729@@ -0,0 +1,27 @@
730+# -*- coding: utf-8 -*-
731+##############################################################################
732+#
733+# OpenERP, Open Source Management Solution
734+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
735+#
736+# This program is free software: you can redistribute it and/or modify
737+# it under the terms of the GNU Affero General Public License as
738+# published by the Free Software Foundation, either version 3 of the
739+# License, or (at your option) any later version.
740+#
741+# This program is distributed in the hope that it will be useful,
742+# but WITHOUT ANY WARRANTY; without even the implied warranty of
743+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
744+# GNU Affero General Public License for more details.
745+#
746+# You should have received a copy of the GNU Affero General Public License
747+# along with this program. If not, see <http://www.gnu.org/licenses/>.
748+#
749+##############################################################################
750+
751+from openerp.openupgrade import openupgrade
752+
753+@openupgrade.migrate()
754+def migrate(cr, version):
755+ model = pool.get('sale.order')
756+ many2one2many2many(cr, model, 'project_issue', 'categ_ids', openupgrade.get_legacy_name('categ_id'))
757
758=== added file 'project_issue/migrations/7.0.1.0/pre-migration.py'
759--- project_issue/migrations/7.0.1.0/pre-migration.py 1970-01-01 00:00:00 +0000
760+++ project_issue/migrations/7.0.1.0/pre-migration.py 2013-06-19 17:53:32 +0000
761@@ -0,0 +1,34 @@
762+# -*- coding: utf-8 -*-
763+##############################################################################
764+#
765+# OpenERP, Open Source Management Solution
766+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
767+#
768+# This program is free software: you can redistribute it and/or modify
769+# it under the terms of the GNU Affero General Public License as
770+# published by the Free Software Foundation, either version 3 of the
771+# License, or (at your option) any later version.
772+#
773+# This program is distributed in the hope that it will be useful,
774+# but WITHOUT ANY WARRANTY; without even the implied warranty of
775+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
776+# GNU Affero General Public License for more details.
777+#
778+# You should have received a copy of the GNU Affero General Public License
779+# along with this program. If not, see <http://www.gnu.org/licenses/>.
780+#
781+##############################################################################
782+
783+from openerp.openupgrade import openupgrade
784+
785+@openupgrade.migrate()
786+def migrate(cr, version):
787+ openupgrade.rename_columns(cr, {
788+ 'project_issue': [
789+ ('categ_id', openupgrade.get_legacy_name('categ_id')),
790+ ('type_id', 'stage_id'),
791+ ],
792+ 'project_issue': [
793+ ('type_id', 'stage_id'),
794+ ],
795+ })
796
797=== added file 'sale/migrations/7.0.1.0/post-migration.py'
798--- sale/migrations/7.0.1.0/post-migration.py 1970-01-01 00:00:00 +0000
799+++ sale/migrations/7.0.1.0/post-migration.py 2013-06-19 17:53:32 +0000
800@@ -0,0 +1,29 @@
801+# -*- coding: utf-8 -*-
802+##############################################################################
803+#
804+# OpenERP, Open Source Management Solution
805+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
806+#
807+# This program is free software: you can redistribute it and/or modify
808+# it under the terms of the GNU Affero General Public License as
809+# published by the Free Software Foundation, either version 3 of the
810+# License, or (at your option) any later version.
811+#
812+# This program is distributed in the hope that it will be useful,
813+# but WITHOUT ANY WARRANTY; without even the implied warranty of
814+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
815+# GNU Affero General Public License for more details.
816+#
817+# You should have received a copy of the GNU Affero General Public License
818+# along with this program. If not, see <http://www.gnu.org/licenses/>.
819+#
820+##############################################################################
821+
822+from openupgrade import openupgrade
823+from openupgrade.openupgrade70 import partner_address_to_partner
824+
825+@openupgrade.migrate()
826+def migrate(cr, version):
827+ partner_address_to_partner(cr, 'sale_order', 'partner_invoice_id')
828+ partner_address_to_partner(cr, 'sale_order', 'partner_shipping_id')
829+ partner_address_to_partner(cr, 'sale_order_line', 'address_allotment_id')
830
831=== added file 'sale_crm/migrations/7.0.1.0/post-migration.py'
832--- sale_crm/migrations/7.0.1.0/post-migration.py 1970-01-01 00:00:00 +0000
833+++ sale_crm/migrations/7.0.1.0/post-migration.py 2013-06-19 17:53:32 +0000
834@@ -0,0 +1,27 @@
835+# -*- coding: utf-8 -*-
836+##############################################################################
837+#
838+# OpenERP, Open Source Management Solution
839+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
840+#
841+# This program is free software: you can redistribute it and/or modify
842+# it under the terms of the GNU Affero General Public License as
843+# published by the Free Software Foundation, either version 3 of the
844+# License, or (at your option) any later version.
845+#
846+# This program is distributed in the hope that it will be useful,
847+# but WITHOUT ANY WARRANTY; without even the implied warranty of
848+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
849+# GNU Affero General Public License for more details.
850+#
851+# You should have received a copy of the GNU Affero General Public License
852+# along with this program. If not, see <http://www.gnu.org/licenses/>.
853+#
854+##############################################################################
855+
856+from openerp.openupgrade import openupgrade
857+
858+@openupgrade.migrate()
859+def migrate(cr, version):
860+ model = pool.get('sale.order')
861+ many2one2many2many(cr, model, 'sale_order', 'categ_ids', openupgrade.get_legacy_name('categ_id'))
862
863=== added file 'sale_crm/migrations/7.0.1.0/pre-migration.py'
864--- sale_crm/migrations/7.0.1.0/pre-migration.py 1970-01-01 00:00:00 +0000
865+++ sale_crm/migrations/7.0.1.0/pre-migration.py 2013-06-19 17:53:32 +0000
866@@ -0,0 +1,30 @@
867+# -*- coding: utf-8 -*-
868+##############################################################################
869+#
870+# OpenERP, Open Source Management Solution
871+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
872+#
873+# This program is free software: you can redistribute it and/or modify
874+# it under the terms of the GNU Affero General Public License as
875+# published by the Free Software Foundation, either version 3 of the
876+# License, or (at your option) any later version.
877+#
878+# This program is distributed in the hope that it will be useful,
879+# but WITHOUT ANY WARRANTY; without even the implied warranty of
880+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
881+# GNU Affero General Public License for more details.
882+#
883+# You should have received a copy of the GNU Affero General Public License
884+# along with this program. If not, see <http://www.gnu.org/licenses/>.
885+#
886+##############################################################################
887+
888+from openerp.openupgrade import openupgrade
889+
890+@openupgrade.migrate()
891+def migrate(cr, version):
892+ openupgrade.rename_columns(cr, {
893+ 'sale_order': [
894+ ('categ_id', openupgrade.get_legacy_name('categ_id')),
895+ ],
896+ })
897
898=== added file 'stock/migrations/7.0.1.1/post-migration.py'
899--- stock/migrations/7.0.1.1/post-migration.py 1970-01-01 00:00:00 +0000
900+++ stock/migrations/7.0.1.1/post-migration.py 2013-06-19 17:53:32 +0000
901@@ -0,0 +1,37 @@
902+# -*- coding: utf-8 -*-
903+##############################################################################
904+#
905+# OpenERP, Open Source Management Solution
906+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
907+#
908+# This program is free software: you can redistribute it and/or modify
909+# it under the terms of the GNU Affero General Public License as
910+# published by the Free Software Foundation, either version 3 of the
911+# License, or (at your option) any later version.
912+#
913+# This program is distributed in the hope that it will be useful,
914+# but WITHOUT ANY WARRANTY; without even the implied warranty of
915+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
916+# GNU Affero General Public License for more details.
917+#
918+# You should have received a copy of the GNU Affero General Public License
919+# along with this program. If not, see <http://www.gnu.org/licenses/>.
920+#
921+##############################################################################
922+
923+from openupgrade import openupgrade
924+from openupgrade.openupgrade70 import partner_address_to_partner
925+
926+_tables_with_address = [
927+ 'report_stock_inventory',
928+ 'report_stock_move',
929+ 'stock_location',
930+ 'stock_move',
931+ 'stock_picking',
932+ 'stock_warehouse',
933+ ]
934+
935+@openupgrade.migrate()
936+def migrate(cr, version):
937+ for table in _tables_with_address:
938+ partner_address_to_partner(cr, table, 'partner_id')
939
940=== added file 'stock/migrations/7.0.1.1/pre-migration.py'
941--- stock/migrations/7.0.1.1/pre-migration.py 1970-01-01 00:00:00 +0000
942+++ stock/migrations/7.0.1.1/pre-migration.py 2013-06-19 17:53:32 +0000
943@@ -0,0 +1,30 @@
944+# -*- coding: utf-8 -*-
945+##############################################################################
946+#
947+# OpenERP, Open Source Management Solution
948+# This migration script copyright (C) 2013 credativ Ltd (<http://credativ.co.uk>).
949+#
950+# This program is free software: you can redistribute it and/or modify
951+# it under the terms of the GNU Affero General Public License as
952+# published by the Free Software Foundation, either version 3 of the
953+# License, or (at your option) any later version.
954+#
955+# This program is distributed in the hope that it will be useful,
956+# but WITHOUT ANY WARRANTY; without even the implied warranty of
957+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
958+# GNU Affero General Public License for more details.
959+#
960+# You should have received a copy of the GNU Affero General Public License
961+# along with this program. If not, see <http://www.gnu.org/licenses/>.
962+#
963+##############################################################################
964+
965+from openerp.openupgrade import openupgrade
966+
967+@openupgrade.migrate()
968+def migrate(cr, version):
969+ openupgrade.rename_columns(cr, {
970+ 'stock_location': [('address_id', 'partner_id')],
971+ 'stock_move': [('address_id', 'partner_id')],
972+ 'stock_picking': [('address_id', 'partner_id')],
973+ })

Subscribers

People subscribed via source and target branches