Integrity error on many2many when using inheritance by prototyping
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
OpenERP Publisher's Warranty Team |
Bug Description
Simple case:
Model A defines a many2many field to model X.
Model B inherits from model A but defines a new name (thus: inheritance by prototyping).
When creating an object of model B, an integrity error occurs. When looking in the console, this is the underlying error:
2013-08-02 12:01:43,125 6440 ERROR test01 openerp.sql_db: bad query: insert into model_a_model_x_rel (model_
Traceback (most recent call last):
File "C:\...
res = self._obj.
IntegrityError: insert or update on table "model_
DETAIL: Key (model_a_id)=(37) is not present in table "model_a".
By doing the inheritance by prototyping, the definition of the many2many field is copied from model a to model b. Thus, the many2many in model b defines the same relational table for storing the relation. Since model b is another table altogether, this doesn't work.
A workaround is to do an overwrite of the many2many in model b to define another relational table, but shouldn't this happen automatically? The same problem could possibly happen with one2many fields (not tested).
Changed in openobject-addons: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
tags: | added: maintenance |