From 3f0aa825f039f344c1bf83002da2aaaedef259bd Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 11 Jun 2015 14:21:39 +0200 Subject: [PATCH] [FIX] ie related fields don't have an ir.model.fields entry --- auditlog/models/rule.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/auditlog/models/rule.py b/auditlog/models/rule.py index 4a67b78cd..03962cc8f 100644 --- a/auditlog/models/rule.py +++ b/auditlog/models/rule.py @@ -389,9 +389,10 @@ class auditlog_rule(models.Model): if field_name in FIELDS_BLACKLIST: continue field = self._get_field(log.model_id, field_name) - log_vals = self._prepare_log_line_vals_on_write( - log, field, old_values, new_values) - log_line_model.create(log_vals) + if field: + log_vals = self._prepare_log_line_vals_on_write( + log, field, old_values, new_values) + log_line_model.create(log_vals) def _prepare_log_line_vals_on_write( self, log, field, old_values, new_values): @@ -434,9 +435,10 @@ class auditlog_rule(models.Model): if field_name in FIELDS_BLACKLIST: continue field = self._get_field(log.model_id, field_name) - log_vals = self._prepare_log_line_vals_on_create( - log, field, new_values) - log_line_model.create(log_vals) + if field: + log_vals = self._prepare_log_line_vals_on_create( + log, field, new_values) + log_line_model.create(log_vals) def _prepare_log_line_vals_on_create(self, log, field, new_values): """Prepare the dictionary of values used to create a log line on a