Browse Source

[ADD] allow overriding modules to pass additional log values

pull/1040/head
Holger Brunn 10 years ago
committed by Enric Tobella
parent
commit
35df81d541
No known key found for this signature in database GPG Key ID: 1A2546A1B7BA2451
  1. 4
      auditlog/models/rule.py

4
auditlog/models/rule.py

@ -274,7 +274,8 @@ class auditlog_rule(models.Model):
return unlink return unlink
def create_logs(self, uid, res_model, res_ids, method, def create_logs(self, uid, res_model, res_ids, method,
old_values=None, new_values=None):
old_values=None, new_values=None,
additional_log_values=None):
"""Create logs. `old_values` and `new_values` are dictionnaries, e.g: """Create logs. `old_values` and `new_values` are dictionnaries, e.g:
{RES_ID: {'FIELD': VALUE, ...}} {RES_ID: {'FIELD': VALUE, ...}}
""" """
@ -295,6 +296,7 @@ class auditlog_rule(models.Model):
'method': method, 'method': method,
'user_id': uid, 'user_id': uid,
} }
vals.update(additional_log_values)
log = log_model.create(vals) log = log_model.create(vals)
diff = DictDiffer( diff = DictDiffer(
new_values.get(res_id, EMPTY_DICT), new_values.get(res_id, EMPTY_DICT),

Loading…
Cancel
Save