[MERGE] forward port of branch 8.0 up to 780dd98
[odoo/odoo.git] / openerp / addons / base / ir / ir_attachment.py
index dcdc595..701a2b7 100644 (file)
@@ -345,4 +345,12 @@ class ir_attachment(osv.osv):
         return self.pool.get('ir.actions.act_window').for_xml_id(
             cr, uid, 'base', 'action_attachment', context=context)
 
+    def invalidate_bundle(self, cr, uid, type='%', xmlid=None, context=None):
+        assert type in ('%', 'css', 'js'), "Unhandled bundle type"
+        xmlid = '%' if xmlid is None else xmlid + '%'
+        domain = [('url', '=like', '/web/%s/%s/%%' % (type, xmlid))]
+        ids = self.search(cr, uid, domain, context=context)
+        if ids:
+            self.unlink(cr, uid, ids, context=context)
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: