Merge lp:~therp-nl/openupgrade-server/6.1-lp1067874-res_currency_init_savepoint into lp:openupgrade-server/6.1

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 3996
Proposed branch: lp:~therp-nl/openupgrade-server/6.1-lp1067874-res_currency_init_savepoint
Merge into: lp:openupgrade-server/6.1
Diff against target: 21 lines (+8/-1)
1 file modified
openerp/addons/base/res/res_currency.py (+8/-1)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-server/6.1-lp1067874-res_currency_init_savepoint
Reviewer Review Type Date Requested Status
Ronald Portier (Therp) Approve
Thomas Winteler (Win-Soft) (community) Approve
Review via email: mp+130208@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Thomas Winteler (Win-Soft) (thomi) :
review: Approve
Revision history for this message
Ronald Portier (Therp) (rportier1962) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/res/res_currency.py'
2--- openerp/addons/base/res/res_currency.py 2012-02-08 22:40:31 +0000
3+++ openerp/addons/base/res/res_currency.py 2012-10-17 19:57:22 +0000
4@@ -91,9 +91,16 @@
5 # we would allow duplicate "global" currencies (all having company_id == NULL)
6 cr.execute("""SELECT indexname FROM pg_indexes WHERE indexname = 'res_currency_unique_name_company_id_idx'""")
7 if not cr.fetchone():
8- cr.execute("""CREATE UNIQUE INDEX res_currency_unique_name_company_id_idx
9+ try:
10+ cr.execute('SAVEPOINT index_currency');
11+ cr.execute("""CREATE UNIQUE INDEX res_currency_unique_name_company_id_idx
12 ON res_currency
13 (name, (COALESCE(company_id,-1)))""")
14+ cr.execute('RELEASE SAVEPOINT index_currency');
15+ except Exception, e:
16+ cr.execute('ROLLBACK TO SAVEPOINT index_currency');
17+ import logging
18+ logging.getLogger('OpenUpgrade').debug('Could not create currency unique index: %s', e)
19
20 def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'):
21 res = super(res_currency, self).read(cr, user, ids, fields, context, load)

Subscribers

People subscribed via source and target branches

to status/vote changes: