[V6.0] restrict, cascade and set null (ondelete options) don't seems to work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
In my db, the foreign keys (ondelete) cascade, set null or restrict isn't working.
I create a field in model tcv_bank_
'detail_
I get the table structure from pgadmin, I found:
-------
-- Table: tcv_bank_
-- DROP TABLE tcv_bank_
CREATE TABLE tcv_bank_
(
id serial NOT NULL,
create_uid integer,
create_date timestamp without time zone,
write_date timestamp without time zone,
write_uid integer,
bank_journal_id integer, -- Bank journal
"name" character varying(64), -- Reference
journal_id integer NOT NULL, -- Journal
prepaid_tax numeric, -- Prepaid tax (%)
detail_id integer NOT NULL, -- Bank config
bank_comission numeric, -- Bank comission (%)
active boolean NOT NULL, -- Active
force_detail boolean, -- Force detail
"type" character varying(16) NOT NULL, -- Type
use_bounced_cheq boolean NOT NULL, -- Use Bounced cheq
CONSTRAINT tcv_bank_
CONSTRAINT tcv_bank_
CONSTRAINT tcv_bank_
)
WITH (
OIDS=FALSE
);
ALTER TABLE tcv_bank_
COMMENT ON TABLE tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
COMMENT ON COLUMN tcv_bank_
-------
As you can see, no foreign key is created, then i I delete a tcv_bank_config record his 'detail' isn't deleted.
I have this problem on my db and try to test it on http://
Found in runbot:
Few field objects (29) have a ir_model_
This field (select) only have 'cascade' and 'set null' options. 'restrict' feature don't exist.
./server/
Is this field deprecated? I don't have permissions to see this at postgres level (in runbot)
-------
Back to my db
Now, I look in many other models an found similar situation (no foreign key created) also fee days back, I note a lot of tables without primary key (all from my own modules),I assumed responsibility for the problem and recreate all primary key index by hand. But now I think the problem is much greater and it is in a more internal level my implementation or OpenERP.
Is there any way to "force" foreing keys to be created?
Look this bugs too: /bugs.launchpad .net/openobject -addons/ +bug/1193393
https:/