Merge lp:~openerp-dev/openobject-addons/6.1-opw-573362-han into lp:openobject-addons/6.1

Proposed by Hardik Ansodariya (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 6738
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-573362-han
Merge into: lp:openobject-addons/6.1
Diff against target: 28 lines (+10/-1)
1 file modified
audittrail/audittrail.py (+10/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-573362-han
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+103648@code.launchpad.net

Description of the change

Hello,

Fixed the problem of maximum recursion depth when object has many2many field of it self with respect of maintenance case:573362 .

Thanks

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Could this branch be merged in addons/6.1 please ?

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Confirmed on Trunk (means still existing and reproducible). A Merge Proposal for trunk was created to fix it. Here is the link to follow the MP on Launchpad https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-573362-port-mma/+merge/132242 and be informed once it's been merged in trunk: ... If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Unmerged revisions

6738. By Hardik Ansodariya (OpenERP)

[Fixed] audittrail: fix the problem of recursion if object contains o2m or m2m field of same object(Maintanace Case: 573362)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'audittrail/audittrail.py'
--- audittrail/audittrail.py 2012-03-23 14:25:41 +0000
+++ audittrail/audittrail.py 2012-04-26 10:17:23 +0000
@@ -344,7 +344,12 @@
344 assert x2m_model_id, _("'%s' Model does not exist..." %(field_obj._obj))344 assert x2m_model_id, _("'%s' Model does not exist..." %(field_obj._obj))
345 x2m_model = pool.get('ir.model').browse(cr, 1, x2m_model_id)345 x2m_model = pool.get('ir.model').browse(cr, 1, x2m_model_id)
346 #recursive call on x2m fields that need to be checked too346 #recursive call on x2m fields that need to be checked too
347 data.update(self.get_data(cr, 1, pool, resource[field], x2m_model, method))347 field_resource_ids = list(set(resource[field]))
348 if model.model == x2m_model.model:
349 # we need to remove current resource_id from the many2many to prevent an infinit loop
350 if resource_id in field_resource_ids:
351 field_resource_ids.remove(resource_id)
352 data.update(self.get_data(cr, 1, pool, field_resource_ids, x2m_model, method))
348 data[(model.id, resource_id)] = {'text':values_text, 'value': values}353 data[(model.id, resource_id)] = {'text':values_text, 'value': values}
349 return data354 return data
350355
@@ -402,6 +407,10 @@
402 x2m_new_values_ids = new_values.get(key, {'value': {}})['value'].get(field_name, [])407 x2m_new_values_ids = new_values.get(key, {'value': {}})['value'].get(field_name, [])
403 # We use list(set(...)) to remove duplicates.408 # We use list(set(...)) to remove duplicates.
404 res_ids = list(set(x2m_old_values_ids + x2m_new_values_ids))409 res_ids = list(set(x2m_old_values_ids + x2m_new_values_ids))
410 if model.model == x2m_model.model:
411 # we need to remove current resource_id from the many2many to prevent an infinit loop
412 if resource_id in res_ids:
413 res_ids.remove(resource_id)
405 for res_id in res_ids:414 for res_id in res_ids:
406 lines.update(self.prepare_audittrail_log_line(cr, 1, pool, x2m_model, res_id, method, old_values, new_values, field_list))415 lines.update(self.prepare_audittrail_log_line(cr, 1, pool, x2m_model, res_id, method, old_values, new_values, field_list))
407 # if the value value is different than the old value: record the change416 # if the value value is different than the old value: record the change