odoo/odoo#208857

Created by fw-bot
Merged at 3e0a42b545b2e76f1d433136407d4dc20237c940

Statuses:

label
odoo-dev:saas-18.1-saas-17.4-runbot-111554-mockrequest_force_website_id-sile-434115-fw
head
8bb369c2a5475e9d6f389d3bbb783f8817c6b7c6
merged
6 months ago by Bugfix, Levi Siuzdak
odoo/odoo
16.0 #201433
17.0 #208671
saas-17.4 #208687
18.0 #208804
saas-18.1 #208857
saas-18.2 #208887
saas-18.3 #209055
saas-18.4
19.0
master #209089

[FW][FIX] website: return correct current website in a `MockRequest`

Versions

  • 16.0+

Steps (saas-17.4)

  1. Install l10n_ar_website_sale;
  2. run :TestWebsiteSaleProductFilters test suite.

Issue

2 tests fails.

Cause

The filters search for sale orders from get_current_website. Even though the correct website is passed to the MockRequest, the result of the call is a website from an Argentinian company with no sales orders.

Solution

Add force_website_id to the MockRequest session, so get_current_website returns the intended website: https://github.com/odoo/odoo/blob/1ea4f285aba925d437a5129cd36143d9987c6e6a/addons/website/models/website.py#L1121

> [!Note]
> Alternatively, we can check for request.website being set in get_current_website. No idea if there's a reason it doesn't already.

runbot-111554
runbot-111555

Forward-Port-Of: #208687
Forward-Port-Of: #201433