Copy() behaves wrongly with translations when object has O2M relations with translatable fields.

Bug #524424 reported by Numérigraphe on 2010-02-19
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Medium
Unassigned
5.0
Invalid
Undecided
Jay Vora (Serpent Consulting Services)

Bug Description

in the current 5.0, when you use a language other than English and copy a stock location with children, the names are wrong:
- the parent's English name is ok but the translated name is that of the last child
- the children's translated names are ok but the English names are replaced with the translated names.
Lionel

Changed in openobject-addons:
assignee: nobody → JMA(Open ERP) (jma-openerp)
Changed in openobject-addons:
status: New → Confirmed
affects: openobject-addons → openobject-server
Changed in openobject-server:
milestone: none → 5.0.9
summary: - Wrong name when duplicating stock location
+ Copy() behaves wrongly with translations when object has parent-child
+ relations with itself.

Hello Lionel,

Here is the patch that helps the user go in the proper direction.

Would you please apply and check?

Till then, I am working on more suitable one.

Thanks.

Changed in openobject-server:
assignee: JMA(Open ERP) (jma-openerp) → Jay (Open ERP) (jvo-openerp)
status: Confirmed → In Progress
description: updated
Numérigraphe (numerigraphe) wrote :

Here's the error I get when trying to duplicate the "Tiny SPRL" location in the demo data, using the French locale:
[2010-03-17 11:06:28,030] ERROR:web-services:[01]:
[2010-03-17 11:06:28,030] ERROR:web-services:[02]: Environment Information :
[2010-03-17 11:06:28,030] ERROR:web-services:[03]: System : Linux-2.6.24-27-generic-i686-with-debian-lenny-sid
[2010-03-17 11:06:28,030] ERROR:web-services:[04]: OS Name : posix
[2010-03-17 11:06:28,030] ERROR:web-services:[05]: Distributor ID: Ubuntu
[2010-03-17 11:06:28,031] ERROR:web-services:[06]: Description: Ubuntu 8.04.4 LTS
[2010-03-17 11:06:28,031] ERROR:web-services:[07]: Release: 8.04
[2010-03-17 11:06:28,031] ERROR:web-services:[08]: Codename: hardy
[2010-03-17 11:06:28,031] ERROR:web-services:[09]: Operating System Release : 2.6.24-27-generic
[2010-03-17 11:06:28,031] ERROR:web-services:[10]: Operating System Version : #1 SMP Mon Feb 22 19:00:31 UTC 2010
[2010-03-17 11:06:28,031] ERROR:web-services:[11]: Operating System Architecture : 32bit
[2010-03-17 11:06:28,031] ERROR:web-services:[12]: Operating System Locale : fr_FR.UTF8
[2010-03-17 11:06:28,031] ERROR:web-services:[13]: Python Version : 2.5.2
[2010-03-17 11:06:28,032] ERROR:web-services:[14]: OpenERP-Server Version : 5.0.7
[2010-03-17 11:06:28,032] ERROR:web-services:[15]: Last revision No. & ID :
[2010-03-17 11:06:28,032] ERROR:web-services:[16]: Traceback (most recent call last):
[2010-03-17 11:06:28,032] ERROR:web-services:[17]: File "/home/ls/Projets/OpenERP/server/5.0/bin/osv/osv.py", line 58, in wrapper
[2010-03-17 11:06:28,032] ERROR:web-services:[18]: return f(self, dbname, *args, **kwargs)
[2010-03-17 11:06:28,032] ERROR:web-services:[19]: File "/home/ls/Projets/OpenERP/server/5.0/bin/osv/osv.py", line 119, in execute
[2010-03-17 11:06:28,032] ERROR:web-services:[20]: res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
[2010-03-17 11:06:28,032] ERROR:web-services:[21]: File "/home/ls/Projets/OpenERP/server/5.0/bin/osv/osv.py", line 111, in execute_cr
[2010-03-17 11:06:28,033] ERROR:web-services:[22]: return getattr(object, method)(cr, uid, *args, **kw)
[2010-03-17 11:06:28,033] ERROR:web-services:[23]: File "/home/ls/Projets/OpenERP/server/5.0/bin/osv/orm.py", line 3144, in copy
[2010-03-17 11:06:28,033] ERROR:web-services:[24]: record['res_id'] = map_trans[record['res_id']]
[2010-03-17 11:06:28,033] ERROR:web-services:[25]: KeyError: 18

Yes Lionel,

I am working for a multilevel translation.

Hello Lionel,

Updates for you!

Here is the updated one. Have a go for that.

Thanks.

Need to work more with more test cases, it fails with some other cases.

Root is O2M reltions.

Thanks.

summary: - Copy() behaves wrongly with translations when object has parent-child
- relations with itself.
+ Copy() behaves wrongly with translations when object has O2M relations
+ with translatable fields.
Changed in openobject-server:
milestone: 5.0.9 → 5.0.10

wrong turn Jay (Open ERP), its duplicate ofitself.

I will propose a new patch soon.
Thanks.

It needs some cleaning of parent_left,parent_right I suppose.

Changed in openobject-server:
milestone: 5.0.10 → 5.0.11
Changed in openobject-server:
milestone: 5.0.11 → 5.0.12
Changed in openobject-server:
importance: Undecided → Medium

Lionel, thanks for the bug report and analysis!

Fix landed in both stable and trunk:
 server-5.0:
  revno: 2075, revision-id: <email address hidden>
 server-trunk:
  revno: 2402, revision-id: <email address hidden>

Changed in openobject-server:
assignee: Jay (Open ERP) (jvo-openerp) → nobody
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers