From ba41c3c1cccfdd7d9e499f426db669bc8efea4e6 Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Mon, 14 Jan 2019 09:35:33 +0000 Subject: [PATCH] [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 --- odoo/addons/base/module/module.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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