# -*- coding: utf-8 -*- from . import models from . import controllers def _reactivate_views(env): """Ensure all module views are active after install/update. Odoo silently deactivates inherited views when an xpath fails validation (e.g. parent view structure changed between versions). Once deactivated, subsequent -u runs never reactivate them. This hook prevents that from silently breaking the portal. """ views = env['ir.ui.view'].sudo().search([ ('key', 'like', 'fusion_authorizer_portal.%'), ('active', '=', False), ]) if views: views.write({'active': True}) env.cr.execute(""" SELECT key FROM ir_ui_view WHERE key LIKE 'fusion_authorizer_portal.%%' AND id = ANY(%s) """, [views.ids]) keys = [r[0] for r in env.cr.fetchall()] import logging logging.getLogger(__name__).warning( "Reactivated %d deactivated views: %s", len(keys), keys )