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

Proposed by Holger Brunn (Therp) on 2012-12-18
Status: Merged
Merged at revision: 6614
Proposed branch: lp:~therp-nl/openupgrade-addons/6.1_fix_base_contact_name
Merge into: lp:openupgrade-addons/6.1
Diff against target: 60 lines (+6/-17)
2 files modified
base_contact/base_contact.py (+3/-1)
base_contact/migrations/6.1.1.0/pre-migration.py (+3/-16)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-addons/6.1_fix_base_contact_name
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) 2012-12-18 Approve on 2012-12-18
Review via email: mp+140473@code.launchpad.net

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_contact/base_contact.py'
2--- base_contact/base_contact.py 2012-02-15 13:22:13 +0000
3+++ base_contact/base_contact.py 2012-12-18 15:24:31 +0000
4@@ -93,7 +93,7 @@
5 return bool(value == 1)
6
7 exists = table_exists(self._table)
8- super(res_partner_contact, self)._auto_init(cr, context)
9+ result=super(res_partner_contact, self)._auto_init(cr, context)
10
11 if not exists:
12 cr.execute("""
13@@ -108,6 +108,8 @@
14 cr.execute("update res_partner_address set contact_id=id")
15 cr.execute("select setval('res_partner_contact_id_seq', (select max(id)+1 from res_partner_contact))")
16
17+ return result
18+
19 res_partner_contact()
20
21 class res_partner_location(osv.osv):
22
23=== modified file 'base_contact/migrations/6.1.1.0/pre-migration.py'
24--- base_contact/migrations/6.1.1.0/pre-migration.py 2012-06-19 09:34:23 +0000
25+++ base_contact/migrations/6.1.1.0/pre-migration.py 2012-12-18 15:24:31 +0000
26@@ -23,31 +23,18 @@
27 import logging
28 from openerp.openupgrade import openupgrade
29
30-logger = logging.getLogger('OpenUpgrade')
31-me = __file__
32-
33-
34 def _migrate_last_name(cr):
35 column_renames = {
36 'res_partner_contact': [
37 ('name', 'last_name'),
38 ],
39 }
40- #if openupgrade.table_exists(cr, 'res_partner_contact'):
41- # return
42- #if not openupgrade.column_exists(cr, 'res_partner_contact', 'last_name'):
43- # return
44 openupgrade.rename_columns(cr, column_renames)
45
46 def _migrate_birthdate(cr):
47 openupgrade.logged_query(cr, 'alter table res_partner_contact alter column birthdate type character varying(64);')
48
49+@openupgrade.migrate()
50 def migrate(cr, version):
51- if not version:
52- return
53- try:
54- logger.info("%s called", me)
55- _migrate_last_name(cr)
56- _migrate_birthdate(cr)
57- except Exception, e:
58- raise osv.except_osv("OpenUpgrade", '%s: %s' % (me, e))
59+ _migrate_last_name(cr)
60+ _migrate_birthdate(cr)

Subscribers

People subscribed via source and target branches