Merge lp:~openerp-dev/openobject-server/6.1-opw-575229-cbi into lp:openobject-server/6.1

Proposed by Chris Biersbach (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/6.1-opw-575229-cbi
Merge into: lp:openobject-server/6.1
Diff against target: 29 lines (+7/-3)
1 file modified
openerp/osv/orm.py (+7/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.1-opw-575229-cbi
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+122240@code.launchpad.net

Description of the change

Bugfix: Changed copy_translations in orm.py to correctly pick the ID of the object correpsonding to an inherited field when copying the translations.
This bug is also present from 5.0 onwards

To reproduce the bug (in 5.0):

1) Install event module
2) Choose Belgium PCMN
3) Load an official translation: French
4) Change french translation of an event
5) Duplicate event
    -> Translation was not duplicated!

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Not reproducible on Trunk. If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

4265. By Chris Biersbach (OpenERP)

[FIX] OPW 575229: ORM: Fixed copy_translations to take ID of _inherits field instead of object ID (forward-port of 5.0 fix)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py 2012-08-26 20:26:55 +0000
+++ openerp/osv/orm.py 2012-08-31 11:05:14 +0000
@@ -4732,20 +4732,24 @@
4732 # and for translatable fields we keep them for copy4732 # and for translatable fields we keep them for copy
4733 elif field_def.get('translate'):4733 elif field_def.get('translate'):
4734 trans_name = ''4734 trans_name = ''
4735 old_id_to_copy, new_id_to_copy = old_id, new_id
4735 if field_name in self._columns:4736 if field_name in self._columns:
4736 trans_name = self._name + "," + field_name4737 trans_name = self._name + "," + field_name
4737 elif field_name in self._inherit_fields:4738 elif field_name in self._inherit_fields:
4738 trans_name = self._inherit_fields[field_name][0] + "," + field_name4739 trans_name = self._inherit_fields[field_name][0] + "," + field_name
4740 parent_field = self._inherit_fields[field_name][1]
4741 old_parent_id, new_parent_id = self.read(cr, uid, [old_id, new_id], [parent_field])
4742 old_id_to_copy, new_id_to_copy = old_parent_id[parent_field][0], new_parent_id[parent_field][0]
4739 if trans_name:4743 if trans_name:
4740 trans_ids = trans_obj.search(cr, uid, [4744 trans_ids = trans_obj.search(cr, uid, [
4741 ('name', '=', trans_name),4745 ('name', '=', trans_name),
4742 ('res_id', '=', old_id)4746 ('res_id','=', old_id_to_copy)
4743 ])4747 ])
4744 translation_records.extend(trans_obj.read(cr, uid, trans_ids, context=context))4748 trans_records = trans_obj.read(cr,uid,trans_ids,context=context)
4749 translation_records.extend(dict(t, res_id=new_id_to_copy) for t in trans_records)
47454750
4746 for record in translation_records:4751 for record in translation_records:
4747 del record['id']4752 del record['id']
4748 record['res_id'] = new_id
4749 trans_obj.create(cr, uid, record, context=context)4753 trans_obj.create(cr, uid, record, context=context)
47504754
47514755