Skip to content
Snippets Groups Projects
user avatar
Adrian Torres authored
Before this revision, any m2o with an ir.* model as inverse could have
the ondelete policy as 'restrict', either by default if it was required
or by setting it explicitly in the field declaration.

This is problematic because ir.* models are reflection models and they
*MUST* be deleted during an uninstall of the module that introduces
them, otherwise tables, fields, constraints, etc. are left in the
database, this is why 'restrict' doesn't make sense UNLESS the unlink is
being performed by an user and not by the system (uninstall).

As a solution, this revision sets the default to cascade if the field is
required, otherwise null.

If the programmer explicitly sets a required m2o field with an ir.*
model as an inverse to ondelete='restrict', it is considered an
unsupported use-case and the registry will crash during loading with a
clear error explaining that it is not supported.

closes odoo/odoo#39739

Signed-off-by: default avatarAdrian Torres (adt) <adt@odoo.com>
f9eeb3b4
History

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

Then follow the developer tutorials