From 44089f9590d7d55a0101651a06d419eee1becb59 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 26 Nov 2015 14:30:12 +0100 Subject: [PATCH] turn off prefetching when reding values --- auditlog/models/rule.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/auditlog/models/rule.py b/auditlog/models/rule.py index 7fa4403ec..9c8291987 100644 --- a/auditlog/models/rule.py +++ b/auditlog/models/rule.py @@ -214,8 +214,8 @@ class AuditlogRule(models.Model): rule_model = self.env['auditlog.rule'] new_record = create.origin(self, vals, **kwargs) new_values = dict( - (d['id'], d) for d in new_record.sudo().read( - list(self._fields))) + (d['id'], d) for d in new_record.sudo() + .with_context(prefetch_fields=False).read(list(self._fields))) rule_model.sudo().create_logs( self.env.uid, self._name, new_record.ids, 'create', None, new_values) @@ -272,10 +272,12 @@ class AuditlogRule(models.Model): self = self.with_context(auditlog_disabled=True) rule_model = self.env['auditlog.rule'] old_values = dict( - (d['id'], d) for d in self.sudo().read(list(self._fields))) + (d['id'], d) for d in self.sudo() + .with_context(prefetch_fields=False).read(list(self._fields))) result = write.origin(self, vals, **kwargs) new_values = dict( - (d['id'], d) for d in self.sudo().read(list(self._fields))) + (d['id'], d) for d in self.sudo() + .with_context(prefetch_fields=False).read(list(self._fields))) rule_model.sudo().create_logs( self.env.uid, self._name, self.ids, 'write', old_values, new_values) @@ -289,7 +291,8 @@ class AuditlogRule(models.Model): self = self.with_context(auditlog_disabled=True) rule_model = self.env['auditlog.rule'] old_values = dict( - (d['id'], d) for d in self.sudo().read(list(self._fields))) + (d['id'], d) for d in self.sudo() + .with_context(prefetch_fields=False).read(list(self._fields))) rule_model.sudo().create_logs( self.env.uid, self._name, self.ids, 'unlink', old_values) return unlink.origin(self, **kwargs)