Turkesh Patel (openERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-978741-tpa into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #978741 in OpenERP Addons: "[audittrail] The field "Resource Name" in the 
object "audittrai.log" is not given automatically"
  https://bugs.launchpad.net/openobject-addons/+bug/978741

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-978741-tpa/+merge/101707

                  Audittrail
========================================================

[Fix]: set proper "Resource Name" in  in the object "audittrai.log".

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-978741-tpa/+merge/101707
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-978741-tpa.
=== modified file 'audittrail/audittrail.py'
--- audittrail/audittrail.py	2012-05-04 11:57:48 +0000
+++ audittrail/audittrail.py	2012-08-23 10:31:02 +0000
@@ -434,6 +434,7 @@
             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,14 @@
 
             # 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 = 'name' in res_name._columns.keys() and res_name.name or ''
                 vals = {
                     'method': method,
                     'object_id': model_id,
                     'user_id': uid,
                     'res_id': resource_id,
+                    'name': name,
                 }
                 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'

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to