From 1d2578c9c4c2ea0c7188ab04b61fbca11ab9eaf3 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 12 Apr 2012 15:24:58 +0530 Subject: [PATCH 1/3] [FIX] audittrail: set the proper resource name. bzr revid: tpa@tinyerp.com-20120412095458-lr6ktlh3sh15o0th --- addons/audittrail/audittrail.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index 78a180e8d4d..9b3f5e4b6fb 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -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' From 1fcea0f2567f0360aa1c0a9baf34f90c4987337b Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 12 Apr 2012 17:14:01 +0530 Subject: [PATCH 2/3] [IMP] audittrail: improved code bzr revid: tpa@tinyerp.com-20120412114401-e5sfeq24w69ucn83 --- addons/audittrail/audittrail.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index 9b3f5e4b6fb..da7a3beaeef 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -442,13 +442,14 @@ 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 + 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': res_name or '', + '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' From 7efb26b94a4c2c9b3a4488320caffb132e9c3cd2 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 23 Aug 2012 16:44:11 +0530 Subject: [PATCH 3/3] [IMP] improved code. bzr revid: tpa@tinyerp.com-20120823111411-18n8pdrbinevs0vc --- addons/audittrail/audittrail.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index 549c84c7ded..6f76ea62429 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -434,7 +434,6 @@ 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 @@ -442,8 +441,7 @@ 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 = 'name' in res_name._columns.keys() and res_name.name or '' + name = pool.get(model.model).name_get(cr, uid, [resource_id])[0][1] vals = { 'method': method, 'object_id': model_id,