From 25ea23eb318ab414cb4e468498c02dc194a1fa63 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 5 Oct 2015 15:24:16 +0200 Subject: [PATCH] [FIX] models: when accessing function fields in multi, read them all at once --- openerp/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openerp/models.py b/openerp/models.py index 4f7c5dd795a..0b966bd2e36 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -3214,6 +3214,14 @@ class BaseModel(object): if fcolumn._prefetch if not fcolumn.groups or self.user_has_groups(fcolumn.groups) } + elif self._columns[field.name]._multi: + # prefetch all function fields with the same value for 'multi' + multi = self._columns[field.name]._multi + fnames = {fname + for fname, fcolumn in self._columns.iteritems() + if fcolumn._multi == multi + if not fcolumn.groups or self.user_has_groups(fcolumn.groups) + } else: fnames = {field.name}