ir_attachment.py 499 B

12345678910111213
  1. from openerp.osv import fields, osv
  2. class ir_attachment(osv.osv):
  3. _inherit = "ir.attachment"
  4. def invalidate_bundle(self, cr, uid, type='%', xmlid=None, context=None):
  5. assert type in ('%', 'css', 'js'), "Unhandled bundle type"
  6. xmlid = '%' if xmlid is None else xmlid + '%'
  7. domain = [('url', '=like', '/web/%s/%s/%%' % (type, xmlid))]
  8. ids = self.search(cr, uid, domain, context=context)
  9. if ids:
  10. self.unlink(cr, uid, ids, context=context)