Merge lp:~openerp-dev/openobject-server/6.0-opw-16889-ach into lp:openobject-server/6.0

Proposed by Anup(SerpentCS)
Status: Merged
Merged at revision: 3486
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-16889-ach
Merge into: lp:openobject-server/6.0
Diff against target: 28 lines (+3/-3)
1 file modified
bin/osv/orm.py (+3/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-16889-ach
Reviewer Review Type Date Requested Status
Christophe CHAUVET (community) Approve
Olivier Dony (Odoo) Pending
Jay Vora (Serpent Consulting Services) Pending
Review via email: mp+72185@code.launchpad.net

Description of the change

Hello

When you try to import a Many2one field in other languages it crashes.

This fixes the issue,

Thanks.

To post a comment you must log in.
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Ok

I have made similar patch in my locale branch to fix this issue

review: Approve
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Thanks Christophe and Anup.

We will have some little tests and we will commit it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/osv/orm.py'
2--- bin/osv/orm.py 2011-06-20 11:12:35 +0000
3+++ bin/osv/orm.py 2011-08-19 13:40:12 +0000
4@@ -723,7 +723,7 @@
5 if mode=='.id':
6 id = int(id)
7 obj_model = self.pool.get(model_name)
8- ids = obj_model.search(cr, uid, [('id', '=', int(id))])
9+ ids = obj_model.search(cr, uid, [('id', '=', int(id))], context=context)
10 if not len(ids):
11 raise Exception(_("Database ID doesn't exist: %s : %s") %(model_name, id))
12 elif mode=='id':
13@@ -732,13 +732,13 @@
14 else:
15 module, xml_id = current_module, id
16 record_id = ir_model_data_obj._get_id(cr, uid, module, xml_id)
17- ir_model_data = ir_model_data_obj.read(cr, uid, [record_id], ['res_id'])
18+ ir_model_data = ir_model_data_obj.read(cr, uid, [record_id], ['res_id'], context=context)
19 if not ir_model_data:
20 raise ValueError('No references to %s.%s' % (module, xml_id))
21 id = ir_model_data[0]['res_id']
22 else:
23 obj_model = self.pool.get(model_name)
24- ids = obj_model.name_search(cr, uid, id, operator='=')
25+ ids = obj_model.name_search(cr, uid, id, operator='=', context=context)
26 if not ids:
27 raise ValueError('No record found for %s' % (id,))
28 id = ids[0][0]