2021-05-10 15:45:35 +02:00
|
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
|
|
|
|
|
|
from odoo import models, tools
|
|
|
|
|
from odoo.http import request
|
|
|
|
|
|
|
|
|
|
|
2024-10-14 14:03:18 +02:00
|
|
|
class IrHttp(models.AbstractModel):
|
|
|
|
|
_inherit = ['ir.http']
|
2021-05-10 15:45:35 +02:00
|
|
|
|
|
|
|
|
@classmethod
|
2022-06-17 15:22:06 +00:00
|
|
|
def _pre_dispatch(cls, rule, args):
|
2021-05-10 15:45:35 +02:00
|
|
|
# Allow public user to use `fw` query string in test mode to ease tests
|
|
|
|
|
force_website_id = request.httprequest.args.get('fw')
|
|
|
|
|
if (request.registry.in_test_mode() or tools.config.options['test_enable']) and force_website_id:
|
|
|
|
|
request.env['website']._force_website(force_website_id)
|
2022-08-30 12:09:14 +00:00
|
|
|
|
|
|
|
|
super()._pre_dispatch(rule, args)
|