diff options
| author | Raphael Collet <rco@odoo.com> | 2020-02-26 11:19:44 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-02-26 12:16:22 +0000 |
| commit | 687793adca8f808afafeb0a6fbc754387a0239d5 (patch) | |
| tree | f942e6de71f05055d25c1f18a32b1948b6d37e58 /odoo | |
| parent | 04052fa21efae38aec98028f0b792e7123972f31 (diff) | |
[IMP] core: do not warn about crappy upgrades in test modules
This allows modifications of models of test modules in stable versions.
closes odoo/odoo#46329
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/addons/base/models/ir_model.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/odoo/addons/base/models/ir_model.py b/odoo/addons/base/models/ir_model.py index c127ed15a95..45d5dae8301 100644 --- a/odoo/addons/base/models/ir_model.py +++ b/odoo/addons/base/models/ir_model.py @@ -220,7 +220,10 @@ class IrModel(models.Model): WHERE type IN ('model', 'model_terms') AND name LIKE %s """, [model.model + ',%']) else: - _logger.warning('The model %s could not be dropped because it did not exist in the registry.', model.model) + # do not warn in the case of a test module + module = self.env.context.get('module', '') + if not module.startswith('test_'): + _logger.warning('The model %s could not be dropped because it did not exist in the registry.', model.model) return True def unlink(self): @@ -2018,7 +2021,9 @@ class IrModelData(models.Model): _logger.info('Deleting %s@%s (%s)', res_id, model, xmlid) record = self.env[model].browse(res_id) if record.exists(): - if record._name == 'ir.model.fields': + module = xmlid.split('.', 1)[0] + record = record.with_context(module=module) + if record._name == 'ir.model.fields' and not module.startswith('test_'): _logger.warning( "Deleting field %s.%s (hint: fields should be" " explicitly removed by an upgrade script)", |
