# Copyright 2026 Munin # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo.http import request from odoo.addons.portal.controllers.portal import CustomerPortal from werkzeug.exceptions import NotFound WHITELISTED_ROUTES = ['/my/home', '/my', '/my/account', '/my/security', '/my/payment_method'] class CustomerPortalPolicy(CustomerPortal): def _prepare_portal_layout_values(self): vals = super()._prepare_portal_layout_values() current_path = request.httprequest.path if request.env.user.validate_portal_url(current_path) or current_path in WHITELISTED_ROUTES: return vals if '/my/' not in current_path: return vals raise NotFound()