[FIX] audittrail: set the proper resource name.
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Thu, 12 Apr 2012 09:54:58 +0000 (15:24 +0530)
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Thu, 12 Apr 2012 09:54:58 +0000 (15:24 +0530)
bzr revid: tpa@tinyerp.com-20120412095458-lr6ktlh3sh15o0th

addons/audittrail/audittrail.py

index 78a180e..9b3f5e4 100644 (file)
@@ -434,6 +434,7 @@ class audittrail_objects_proxy(object_proxy):
             on specific fields only.
         :return: True
         """
+        resource_pool = pool.get(model.model)
         # loop on all the given ids
         for res_id in res_ids:
             # compare old and new values and get audittrail log lines accordingly
@@ -441,11 +442,13 @@ class audittrail_objects_proxy(object_proxy):
 
             # if at least one modification has been found
             for model_id, resource_id in lines:
+                res_name = resource_pool.browse(cr, uid, resource_id).name
                 vals = {
                     'method': method,
                     'object_id': model_id,
                     'user_id': uid,
                     'res_id': resource_id,
+                    'name': res_name or '',
                 }
                 if (model_id, resource_id) not in old_values and method not in ('copy', 'read'):
                     # the resource was not existing so we are forcing the method to 'create'