summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNans Lefebvre <len@odoo.com>2019-01-14 09:35:33 +0000
committerNans Lefebvre <len@odoo.com>2019-01-17 15:08:31 +0000
commitba41c3c1cccfdd7d9e499f426db669bc8efea4e6 (patch)
treeb491ae542333843e240325a6fe7949f7e297e674
parent187c32c2c72fc0668a97c97a99123107aebf3d06 (diff)
[FIX] base: disable prefetching during module uninstall #2
Create any module that inherit 'res.lang'. Define any new field that is added with that inheritance. Install that module. Then try to uninstall it. Traceback ensues. When trying to write 'state': 'uninstalled' on the module, the prefetching tries to read a column that has been deleted by the _module_data_uninstall. opw 1917369 closes odoo/odoo#30176
-rw-r--r--odoo/addons/base/module/module.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/addons/base/module/module.py b/odoo/addons/base/module/module.py
index 9c70e29a668..cad65d0114e 100644
--- a/odoo/addons/base/module/module.py
+++ b/odoo/addons/base/module/module.py
@@ -463,7 +463,8 @@ class Module(models.Model):
"""
modules_to_remove = self.mapped('name')
self.env['ir.model.data']._module_data_uninstall(modules_to_remove)
- self.write({'state': 'uninstalled', 'latest_version': False})
+ # we deactivate prefetching to not try to read a column that has been deleted
+ self.with_context(prefetch_fields=False).write({'state': 'uninstalled', 'latest_version': False})
return True
@api.multi