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
=== modified file 'bin/osv/orm.py'
--- bin/osv/orm.py 2011-06-20 11:12:35 +0000
+++ bin/osv/orm.py 2011-08-19 13:40:12 +0000
@@ -723,7 +723,7 @@
723 if mode=='.id':723 if mode=='.id':
724 id = int(id)724 id = int(id)
725 obj_model = self.pool.get(model_name)725 obj_model = self.pool.get(model_name)
726 ids = obj_model.search(cr, uid, [('id', '=', int(id))])726 ids = obj_model.search(cr, uid, [('id', '=', int(id))], context=context)
727 if not len(ids):727 if not len(ids):
728 raise Exception(_("Database ID doesn't exist: %s : %s") %(model_name, id))728 raise Exception(_("Database ID doesn't exist: %s : %s") %(model_name, id))
729 elif mode=='id':729 elif mode=='id':
@@ -732,13 +732,13 @@
732 else:732 else:
733 module, xml_id = current_module, id733 module, xml_id = current_module, id
734 record_id = ir_model_data_obj._get_id(cr, uid, module, xml_id)734 record_id = ir_model_data_obj._get_id(cr, uid, module, xml_id)
735 ir_model_data = ir_model_data_obj.read(cr, uid, [record_id], ['res_id'])735 ir_model_data = ir_model_data_obj.read(cr, uid, [record_id], ['res_id'], context=context)
736 if not ir_model_data:736 if not ir_model_data:
737 raise ValueError('No references to %s.%s' % (module, xml_id))737 raise ValueError('No references to %s.%s' % (module, xml_id))
738 id = ir_model_data[0]['res_id']738 id = ir_model_data[0]['res_id']
739 else:739 else:
740 obj_model = self.pool.get(model_name)740 obj_model = self.pool.get(model_name)
741 ids = obj_model.name_search(cr, uid, id, operator='=')741 ids = obj_model.name_search(cr, uid, id, operator='=', context=context)
742 if not ids:742 if not ids:
743 raise ValueError('No record found for %s' % (id,))743 raise ValueError('No record found for %s' % (id,))
744 id = ids[0][0]744 id = ids[0][0]