Merge lp:~therp-nl/therp-backports/server61-lp950948-allow_crafted_export_xml_ids into lp:therp-backports/server-6.1

Proposed by Stefan Rijnhart (Opener) on 2012-10-14
Status: Merged
Merged at revision: 4295
Proposed branch: lp:~therp-nl/therp-backports/server61-lp950948-allow_crafted_export_xml_ids
Merge into: lp:therp-backports/server-6.1
Diff against target: 20 lines (+9/-1)
1 file modified
openerp/osv/orm.py (+9/-1)
To merge this branch: bzr merge lp:~therp-nl/therp-backports/server61-lp950948-allow_crafted_export_xml_ids
Reviewer Review Type Date Requested Status
Therp 2012-10-14 Pending
Review via email: mp+129596@code.launchpad.net
To post a comment you must log in.
4291. By Stefan Rijnhart (Opener) on 2012-10-14

[FIX] Crafted export xml ids are based on table names, not model names

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/osv/orm.py'
2--- openerp/osv/orm.py 2012-09-24 14:00:07 +0000
3+++ openerp/osv/orm.py 2012-10-14 19:12:21 +0000
4@@ -1265,7 +1265,15 @@
5 module, xml_id = id.rsplit('.', 1)
6 else:
7 module, xml_id = current_module, id
8- record_id = ir_model_data_obj._get_id(cr, uid, module, xml_id)
9+ try:
10+ record_id = ir_model_data_obj._get_id(cr, uid, module, xml_id)
11+ except ValueError, e:
12+ id_parts = xml_id.split('_')
13+ obj_model = self.pool.get(model_name)
14+ if not (module == '__export__' and
15+ obj_model._table == '_'.join(id_parts[:-1])):
16+ raise
17+ return _get_id(model_name, id_parts[-1], mode='.id')
18 ir_model_data = ir_model_data_obj.read(cr, uid, [record_id], ['res_id'])
19 if not ir_model_data:
20 raise ValueError('No references to %s.%s' % (module, xml_id))

Subscribers

People subscribed via source and target branches

to all changes: