Server ORM bug V5 (copy translation). Error when duplicating product, using product_variant_multi

Bug #685827 reported by Sébastien BEAU - http://www.akretion.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Status tracked in Trunk
5.0
Won't Fix
Undecided
Somesh Khare
Trunk
Fix Released
Medium
OpenERP's Framework R&D

Bug Description

Hi
After installing product_variant_multi (in multilanguage), I can not duplicate anymore a product.
Indeed, If you look in the orm, a recursive function is used to duplicated all of the translation.

In the case of the product_variant_multi, the object "product_product" inherit "product.template"
Here are the relation between the two object
"product.product"=>product_tmpl_id : many2one=>"product.template"
"product.template"=>variants_ids : one2many=>"product.product"

Note : the object "product.product" have as field the field "variants_ids" in the list of its fields indeed it inherit the product.template.

When we try to duplicate the translation, we use the recursive method on all many2one and one2many fields.
The first called is done on the object "product.product". As this object have the fields variants_ids which is a related fields (one2many) related to "product.product", the recursive function is called with the same value, and we enter in a infinite loop. By chance the ORM stop the process after X recursion, and raise an error.

I join a patch.

Hope it will help.

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :
Changed in openobject-server:
status: New → Confirmed
importance: Undecided → Medium
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
Changed in openobject-server:
assignee: OpenERP's Framework R&D (openerp-dev-framework) → SKH(OpenERP) (skh-openerp)
Revision history for this message
Somesh Khare (somesh.khare) wrote :

Hello Sébastien,

Your patch solves the issue undoubtedly for _inherits, but its not accurate as it breaks the flow of copy for the objects which have O2M relation with itself(i.e. account, category,locations, etc.).

Not only the check of same relation is to be maintained,but also it needs to check the ID which is being copied.

With the new patch attached, you will be able to understand what I meant here.

Share your words please.

Thanks.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

we don't plan to fix, it's in extra-addons.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This is a duplicate of bug 673194, which is now fixed, so this issue should not happen anymore.
Thanks for reporting!

I will mark the bug as duplicate, too.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

For v5.0 unfortunately we cannot apply the same fix, because it is too risky.
I think the extra-addons modules do have a workaround implemented in v5.0, so it is less of an issue anyway. It is always possible to override the copy_* methods to fix it, too.

Revision history for this message
Nathan (nathan-bowden-kiwi) wrote :

Olivier, this coming in extra-addons, but only due to server, no?

Revision history for this message
Nathan (nathan-bowden-kiwi) wrote :

Or yes, there should be a constraint not to allow m2o-o2m back relation on _inherits feature.
I discussed here in my team,its looks good.

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

This bug was fixed on V6, I share the backport patch, that Anevia uses in production.
Best Regards

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.