Code review comment for lp://staging/~therp-nl/openupgrade-tools/7.0-add-database_cleanup

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hi Stefan,

Thanks for this handy module!

I had an error when purging a model having attachments (poweremail.mailbox). Not sure if this issue lies in the ir.attachment code or the purge though.

In openerp/addons/base/ir/ir_attachment.py the method check() calls exists on the deleted model.

            mids = self.pool.get(model).exists(cr, uid, mids)
            ima.check(cr, uid, model, mode)
            self.pool.get(model).check_access_rule(cr, uid, mids, mode, context=context)

Maybe should the purge delete the attachments or drop the relationship beforehand?

Traceback (most recent call last):
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/server/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/server/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/server/openerp/osv/osv.py", line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/server/openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/server/openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/server/openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/openupgrade-tools/database_cleanup/model/purge_wizard.py", line 58, in purge_all
    context=context)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/openupgrade-tools/database_cleanup/model/purge_models.py", line 73, in purge
    context=context)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/addons/base_calendar/crm_meeting.py", line 160, in write
    return super(ir_attachment, self).write(cr, uid, ids, vals, context=context)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/addons/document/document.py", line 137, in write
    return super(document_file, self).write(cr, uid, ids, vals, context)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/server/openerp/addons/base/ir/ir_attachment.py", line 277, in write
    self.check(cr, uid, ids, 'write', context=context, values=vals)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/addons/document/document.py", line 77, in check
    super(document_file, self).check(cr, uid, ids, mode, context=context, values=values)
  File "/home/gbaconnier/code/instances/openerp_foobar/trunk7/parts/server/openerp/addons/base/ir/ir_attachment.py", line 211, in check
    mids = self.pool.get(model).exists(cr, uid, mids)
AttributeError: 'NoneType' object has no attribute 'exists'

« Back to merge proposal