Community mailing list archives

community@mail.odoo.com

Re: Unlink and ondelete="cascade"

by
Holger Brunn
- 03/03/2016 05:11:47
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

> Does |ondelete="cascade"| only delete the |ModelChild| records via
> database query and not from |unlink| method?

yes. In case you need this to go via the ORM, override unlink() in the
parent model en do your deletions manually. Then you should also set
ondelete='restrict' to be notified if things go wrong

- -- 
Therp - Maatwerk in open ontwikkeling

Holger Brunn - Ontwerp en implementatie

mail: holger@therp.nl
web: http://therp.nl
phone: +31 (0)20 3093096
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iF4EAREIAAYFAlbYDd4ACgkQAcl2D+yjrhhdhAD7B3eW/dAS1eJJSPpzYbItF3BL
EhJ8enzgFrsjF1UqEC0BAIykZdpiWwI9J6I3Ns+d0ksEvrNgKRd5+y0L8MTnAljO
=KxVo
-----END PGP SIGNATURE-----