From 6ffb4a5d58de254b8fe305015d6a982b7721d400 Mon Sep 17 00:00:00 2001 From: sebalix Date: Wed, 7 Mar 2018 15:45:59 +0100 Subject: [PATCH] [FIX] Do not prefetch all fields when retrieving the user context, this crashes Odoo >= 10.0 when we add fields on 'res.users' or 'res.partner' data models while the module is not yet updated (the field does not exist in the database) --- anybox/recipe/odoo/runtime/session.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/anybox/recipe/odoo/runtime/session.py b/anybox/recipe/odoo/runtime/session.py index 9b15f20a..1df71367 100644 --- a/anybox/recipe/odoo/runtime/session.py +++ b/anybox/recipe/odoo/runtime/session.py @@ -195,7 +195,8 @@ def open(self, db=None, with_demo=False): self.init_cursor() self.uid = SUPERUSER_ID self.init_environments() - self.context = self.env['res.users'].context_get() + self.context = self.env['res.users'].with_context( + prefetch_fields=False).context_get() self.env = odoo.api.Environment(self.cr, self.uid, self.context) def init_environments(self):