Merge lp:~openerp-dev/openobject-addons/7.0-opw-593569-pna into lp:openobject-addons/7.0

Proposed by Pinakin Nayi (OpenERP)
Status: Rejected
Rejected by: Martin Trigaux (OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-593569-pna
Merge into: lp:openobject-addons/7.0
Diff against target: 29 lines (+4/-2)
1 file modified
audittrail/audittrail.py (+4/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-593569-pna
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+170028@code.launchpad.net

Description of the change

Hello Sir,

I fixed issue in audittrail.

Steps to reproduce the issue you have observed
  -Install purchase & audittrail modules
  -Create a audittrail.log to purchase.order object (delete, create, write) and add users
  -Push button suscribe
  -Open a P.O. and try delete it gives traceback.
Video with test case: http://youtu.be/uXVS8i3zEvY
Back-ported : lp:~openerp-dev/openobject-addons/trunk-bug-1177840-dharmraj

Thanks,
pna

To post a comment you must log in.
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Duplicate of lp:~openerp-dev/openobject-addons/7.0-opw-604750-skh
I have merged Somesh's one (rev 9892) as it was a bit more flexible (fallback on False if no 'name' key).
I will reject this one then.

Regards

Unmerged revisions

9246. By Pinakin Nayi (OpenERP)

[FIX]audittrail : when on subscribed object try to delete records its gives traceback

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'audittrail/audittrail.py'
2--- audittrail/audittrail.py 2012-12-17 15:46:28 +0000
3+++ audittrail/audittrail.py 2013-06-18 09:56:05 +0000
4@@ -459,13 +459,11 @@
5
6 # if at least one modification has been found
7 for model_id, resource_id in lines:
8- name = pool.get(model.model).name_get(cr, uid, [resource_id])[0][1]
9 vals = {
10 'method': method,
11 'object_id': model_id,
12 'user_id': uid,
13 'res_id': resource_id,
14- 'name': name,
15 }
16 if (model_id, resource_id) not in old_values and method not in ('copy', 'read'):
17 # the resource was not existing so we are forcing the method to 'create'
18@@ -476,7 +474,11 @@
19 # the resource is not existing anymore so we are forcing the method to 'unlink'
20 # (because it could also come with the value 'write' if we are deleting the
21 # record through a one2many field)
22+ name = old_values[(model_id, resource_id)]['value']['name']
23 vals.update({'method': 'unlink'})
24+ else :
25+ name = pool[model.model].name_get(cr, uid, [resource_id])[0][1]
26+ vals.update({'name': name})
27 # create the audittrail log in super admin mode, only if a change has been detected
28 if lines[(model_id, resource_id)]:
29 log_id = pool.get('audittrail.log').create(cr, SUPERUSER_ID, vals)