Recursive copy of translations causes infinite loop when there is a cycle in the related fields

Bug #673194 reported by Don Kirkby
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
Anup(SerpentCS)
Odoo Server (MOVED TO GITHUB)
Fix Released
Medium
OpenERP's Framework R&D

Bug Description

If you set up related fields that have a cycle, then duplicating a record goes into an infinite loop.

For example, install the product_variant_multi module from extra-addons. It has a relationship from product_product to product_template, and one from product_template to product_product. Once you've installed it, try to duplicate one of the products using the Form: Duplicate menu item. It will go into an infinite loop and never finish. The server will not respond to SIGINT.

It looks like this problem occurred in revision 2075 of the 5.0 branch during release 5.0.12. Olivier Dony implemented "proper recursive copy of translations through one2many relationships during copy()". Before that, it appears the product_variant_multi module had successfully avoided problems with the related fields cycle by overriding the product_product.copy() method and the product_template.copy() method and using the default parameter to skip one of the relationships in the cycle. I can't see any way to similarly skip a relationship in the copy_translations() method.

I have reproduced the problem using release 5.0.15 of the 5.0 branch.

Related branches

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Medium
milestone: none → 6.0-rc2
status: New → Confirmed
Changed in openobject-server:
status: Confirmed → In Progress
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Thanks for the proposed fix Don!
I have use a different strategy to attempt to cover more cases, keeping track (via the context) of already visited records during copy of translations (and copy of data as well!). This solves the issue with product_multi_variant, and also removes the need for the overriding copy() in case of circular relationships.

The fix has landed in trunk with revision 3055 <email address hidden>
Thanks for reporting!

Changed in openobject-server:
status: In Progress → Fix Released
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Note: for 5.0, I think this change is a bit risky, so instead my advice is to override copy_translations() in product_multi_variant and employ the same strategy I used, keeping track of visited records in the context.

Changed in openobject-addons:
assignee: nobody → Anup (OpenERP) (ach-openerp)
status: New → Confirmed
tags: added: 5.0 maintenance
Changed in openobject-addons:
importance: Undecided → Medium
Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello guys,

   I agree with Olivier Dony that it is risky to fix this in 5.0 server. So I have fixed it in product_variant_multi module.
   It has been fixed by revision 4767 <email address hidden>

Thanks.

Changed in openobject-addons:
status: Confirmed → Fix Released
milestone: none → 5.0.16
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