Hardik Ansodariya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-573362-han into
lp:openobject-addons/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-573362-han/+merge/103646
Hello,
Fixed the problem of maximum recursion depth when object has many2many field of
it self.
Thanks
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-573362-han/+merge/103646
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-573362-han.
=== modified file 'account/account.py'
--- account/account.py 2012-03-22 12:24:19 +0000
+++ account/account.py 2012-04-26 09:58:24 +0000
@@ -1351,7 +1351,9 @@
def button_cancel(self, cr, uid, ids, context=None):
for line in self.browse(cr, uid, ids, context=context):
- if not line.journal_id.update_posted:
+ if line.period_id.state == 'done':
+ raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of closed periods'))
+ elif not line.journal_id.update_posted:
raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.'))
if ids:
cr.execute('UPDATE account_move '\
=== modified file 'audittrail/audittrail.py'
--- audittrail/audittrail.py 2012-03-23 14:25:41 +0000
+++ audittrail/audittrail.py 2012-04-26 09:58:24 +0000
@@ -344,7 +344,12 @@
assert x2m_model_id, _("'%s' Model does not exist..." %(field_obj._obj))
x2m_model = pool.get('ir.model').browse(cr, 1, x2m_model_id)
#recursive call on x2m fields that need to be checked too
- data.update(self.get_data(cr, 1, pool, resource[field], x2m_model, method))
+ field_resource_ids = list(set(resource[field]))
+ if model.model == x2m_model.model:
+ # we need to remove current resource_id from the many2many to prevent an infinit loop
+ if resource_id in field_resource_ids:
+ field_resource_ids.remove(resource_id)
+ data.update(self.get_data(cr, 1, pool, field_resource_ids, x2m_model, method))
data[(model.id, resource_id)] = {'text':values_text, 'value': values}
return data
@@ -402,6 +407,10 @@
x2m_new_values_ids = new_values.get(key, {'value': {}})['value'].get(field_name, [])
# We use list(set(...)) to remove duplicates.
res_ids = list(set(x2m_old_values_ids + x2m_new_values_ids))
+ if model.model == x2m_model.model:
+ # we need to remove current resource_id from the many2many to prevent an infinit loop
+ if resource_id in res_ids:
+ res_ids.remove(resource_id)
for res_id in res_ids:
lines.update(self.prepare_audittrail_log_line(cr, 1, pool, x2m_model, res_id, method, old_values, new_values, field_list))
# if the value value is different than the old value: record the change
_______________________________________________
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