Browse Source

Merge pull request #178 from hbrunn/8.0-auditlog_dont_crash_on_related_fields

[FIX] ie related fields don't have an ir.model.fields entry
pull/202/merge
Pedro M. Baeza 10 years ago
parent
commit
f208e2d948
  1. 5
      auditlog/models/rule.py

5
auditlog/models/rule.py

@ -358,6 +358,7 @@ class auditlog_rule(models.Model):
if field_name in FIELDS_BLACKLIST:
continue
field = self._get_field(log.model_id, field_name)
# not all fields have an ir.models.field entry (ie. related fields)
if field:
log_vals = self._prepare_log_line_vals_on_read(
log, field, read_values)
@ -389,6 +390,8 @@ class auditlog_rule(models.Model):
if field_name in FIELDS_BLACKLIST:
continue
field = self._get_field(log.model_id, field_name)
# not all fields have an ir.models.field entry (ie. related fields)
if field:
log_vals = self._prepare_log_line_vals_on_write(
log, field, old_values, new_values)
log_line_model.create(log_vals)
@ -434,6 +437,8 @@ class auditlog_rule(models.Model):
if field_name in FIELDS_BLACKLIST:
continue
field = self._get_field(log.model_id, field_name)
# not all fields have an ir.models.field entry (ie. related fields)
if field:
log_vals = self._prepare_log_line_vals_on_create(
log, field, new_values)
log_line_model.create(log_vals)

Loading…
Cancel
Save