diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-07-05 15:35:24 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-07-05 15:35:24 +0200 |
| commit | b06c09db604a580acc85eb75ce68f42880ba9b73 (patch) | |
| tree | 11f47d94a592d8a1ebebc3e3355cfc617821d3f9 /odoo | |
| parent | ce84bacd720bb2cde32ff82b63d19652f452df61 (diff) | |
| parent | 92e5da6b8fdc6084edd863a5e02a8cd9bd33512c (diff) | |
[MERGE] forward port branch saas-14 up to 92e5da6b8fd
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/addons/base/ir/ir_ui_view.py | 6 | ||||
| -rw-r--r-- | odoo/modules/loading.py | 17 |
2 files changed, 19 insertions, 4 deletions
diff --git a/odoo/addons/base/ir/ir_ui_view.py b/odoo/addons/base/ir/ir_ui_view.py index 1d6dba6224e..133aecec2e1 100644 --- a/odoo/addons/base/ir/ir_ui_view.py +++ b/odoo/addons/base/ir/ir_ui_view.py @@ -405,6 +405,12 @@ actual arch. self.clear_caches() return super(View, self).write(self._compute_defaults(vals)) + def unlink(self): + # if in uninstall mode and has children views, emulate an ondelete cascade + if self.env.context.get('_force_unlink', False) and self.mapped('inherit_children_ids'): + self.mapped('inherit_children_ids').unlink() + super(View, self).unlink() + @api.multi def toggle(self): """ Switches between enabled and disabled statuses diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index aab61d3ba67..bff7bc7a3ba 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -123,7 +123,17 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, continue _logger.debug('loading module %s (%d/%d)', module_name, index, module_count) - migrations.migrate_module(package, 'pre') + + needs_update = ( + hasattr(package, "init") + or hasattr(package, "update") + or package.state in ("to install", "to upgrade") + ) + if needs_update: + if package.name != 'base': + registry.setup_models(cr, partial=True) + migrations.migrate_module(package, 'pre') + load_openerp_module(package.name) new_install = package.state == 'to install' @@ -136,8 +146,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, model_names = registry.load(cr, package) loaded_modules.append(package.name) - if (hasattr(package, 'init') or hasattr(package, 'update') - or package.state in ('to install', 'to upgrade')): + if needs_update: models_updated |= set(model_names) models_to_check -= set(model_names) registry.setup_models(cr, partial=True) @@ -157,7 +166,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, if hasattr(package, 'init') or package.state == 'to install': mode = 'init' - if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'): + if needs_update: env = api.Environment(cr, SUPERUSER_ID, {}) # Can't put this line out of the loop: ir.module.module will be # registered by init_models() above. |
