Merge lp:~openerp-dev/openobject-addons/trunk-bug-1012931-kjo into lp:openobject-addons

Proposed by Kuldeep Joshi(OpenERP)
Status: Rejected
Rejected by: Arnaud Pineux (OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1012931-kjo
Merge into: lp:openobject-addons
Diff against target: 77 lines (+29/-23)
1 file modified
audittrail/audittrail.py (+29/-23)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1012931-kjo
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+111222@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Arnaud Pineux (OpenERP) (api-openerp) wrote :

Hi, this branch isn't necessary because the bug it was supposed to fix doesn't exist anymore.

Arnaud

6912. By Arnaud Pineux (OpenERP)

Bug

6913. By Arnaud Pineux (OpenERP)

[MERGE]trunk-bug-1012931

Unmerged revisions

6913. By Arnaud Pineux (OpenERP)

[MERGE]trunk-bug-1012931

6912. By Arnaud Pineux (OpenERP)

Bug

6911. By Kuldeep Joshi(OpenERP)

[FIX]audittrial: check field in column or not

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-05-04 11:57:48 +0000
3+++ audittrail/audittrail.py 2012-06-20 13:24:21 +0000
4@@ -188,18 +188,20 @@
5 :param recursive: True or False, True will repeat the process recursively
6 :return: string value or a list of values(for O2M/M2M)
7 """
8-
9- field_obj = (resource_pool._all_columns.get(field)).column
10- if field_obj._type in ('one2many','many2many'):
11- data = pool.get(field_obj._obj).name_get(cr, uid, value)
12- #return the modifications on x2many fields as a list of names
13- res = map(lambda x:x[1], data)
14- elif field_obj._type == 'many2one':
15- #return the modifications on a many2one field as its value returned by name_get()
16- res = value and value[1] or value
17+ if field not in resource_pool._all_columns.keys():
18+ return value
19 else:
20- res = value
21- return res
22+ field_obj = (resource_pool._all_columns.get(field)).column
23+ if field_obj._type in ('one2many','many2many'):
24+ data = pool.get(field_obj._obj).name_get(cr, uid, value)
25+ #return the modifications on x2many fields as a list of names
26+ res = map(lambda x:x[1], data)
27+ elif field_obj._type == 'many2one':
28+ #return the modifications on a many2one field as its value returned by name_get()
29+ res = value and value[1] or value
30+ else:
31+ res = value
32+ return res
33
34 def create_log_line(self, cr, uid, log_id, model, lines=[]):
35 """
36@@ -333,18 +335,20 @@
37 values[field] = resource[field]
38 # get the textual value of that field for this record
39 values_text[field] = self.get_value_text(cr, 1, pool, resource_pool, method, field, resource[field])
40-
41- field_obj = resource_pool._all_columns.get(field).column
42- if field_obj._type in ('one2many','many2many'):
43- # check if an audittrail rule apply in super admin mode
44- if self.check_rules(cr, 1, field_obj._obj, method):
45- # check if the model associated to a *2m field exists, in super admin mode
46- x2m_model_ids = pool.get('ir.model').search(cr, 1, [('model', '=', field_obj._obj)])
47- x2m_model_id = x2m_model_ids and x2m_model_ids[0] or False
48- assert x2m_model_id, _("'%s' Model does not exist..." %(field_obj._obj))
49- x2m_model = pool.get('ir.model').browse(cr, 1, x2m_model_id)
50- #recursive call on x2m fields that need to be checked too
51- data.update(self.get_data(cr, 1, pool, resource[field], x2m_model, method))
52+ if field not in resource_pool._all_columns.keys():
53+ pass
54+ else:
55+ field_obj = resource_pool._all_columns.get(field).column
56+ if field_obj._type in ('one2many','many2many'):
57+ # check if an audittrail rule apply in super admin mode
58+ if self.check_rules(cr, 1, field_obj._obj, method):
59+ # check if the model associated to a *2m field exists, in super admin mode
60+ x2m_model_ids = pool.get('ir.model').search(cr, 1, [('model', '=', field_obj._obj)])
61+ x2m_model_id = x2m_model_ids and x2m_model_ids[0] or False
62+ assert x2m_model_id, _("'%s' Model does not exist..." %(field_obj._obj))
63+ x2m_model = pool.get('ir.model').browse(cr, 1, x2m_model_id)
64+ #recursive call on x2m fields that need to be checked too
65+ data.update(self.get_data(cr, 1, pool, resource[field], x2m_model, method))
66 data[(model.id, resource_id)] = {'text':values_text, 'value': values}
67 return data
68
69@@ -404,6 +408,8 @@
70 for res_id in res_ids:
71 lines.update(self.prepare_audittrail_log_line(cr, 1, pool, x2m_model, res_id, method, old_values, new_values, field_list))
72 # if the value value is different than the old value: record the change
73+ if field_name == 'id':
74+ continue
75 if key not in old_values or key not in new_values or old_values[key]['value'][field_name] != new_values[key]['value'][field_name]:
76 data = {
77 'name': field_name,

Subscribers

People subscribed via source and target branches

to all changes: