[FIX] Force safer ondelete=restrict on the `alias_id` _inherits FK on models with...
authorOlivier Dony <odo@openerp.com>
Tue, 27 Aug 2013 15:07:08 +0000 (17:07 +0200)
committerOlivier Dony <odo@openerp.com>
Tue, 27 Aug 2013 15:07:08 +0000 (17:07 +0200)
commitbaef4d3d92501be88bed88970096cbe2219be832
treeb3fca336764c46f4cd5f5dcb8bca6f51748c6d4b
parentf9a01a68a1bbe32ece213c4dc345c990fd57abfe
[FIX] Force safer ondelete=restrict on the `alias_id` _inherits FK on models with a mail.alias parent

The delete-rule was initially set to `cascade` in revision
6897.16.13 revid:odo@openerp.com-20120705141706-5gm5mmqode3bvkuc
because the ORM would not allow anything else for the FK of
an _inherits relationship.
This constraint was later lifted in 7.0 server at revision
4681 revid:odo@openerp.com-20121212210247-emrz5rf9ewcwdggu
so we can now switch to the intended default behavior:
when deleting mail aliases we never want to cascade delete
the child records, as that could lead to unwanted deletions.
On the other hand the aliases are automatically deleted when
the record they belong to is deleted, as a kind of internal
dependency. This is the intended safe way to delete them.

There is a special case when the same alias is manually set
on multiple records, in which case you will not be able to
delete any of those records. This is an acceptable exception
and should be manually handled if ever needed, by temporarily
linking the records to delete to new dummy aliases.

bzr revid: odo@openerp.com-20130827150708-62hqk8p7twd527n0
addons/crm/crm.py
addons/hr_recruitment/hr_recruitment.py
addons/mail/mail_group.py
addons/mail/res_users.py
addons/project/project.py