openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #24372
[Bug 1207694] Re: Integrity error on many2many when using inheritance by prototyping
** Changed in: openobject-addons
Assignee: (unassigned) => OpenERP Publisher's Warranty Team (openerp-opw)
** Tags added: maintenance
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1207694
Title:
Integrity error on many2many when using inheritance by prototyping
Status in OpenERP Addons (modules):
New
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_a_id,model_x_id) values (37, 6)
Traceback (most recent call last):
File "C:\...\openerp-server\openerp\sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
IntegrityError: insert or update on table "model_a_model_x_rel" violates foreign key constraint "model_a_model_x_rel_model_a_id_fkey"
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).
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1207694/+subscriptions
References