odoo/odoo#208687
Created by fw-bot
Merged
at 8e04f21a3c7c6500b95de2df295e1a5e781fb803
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:saas-17.4-saas-17.4-runbot-111554-mockrequest_force_website_id-sile-433914-fw
- head
- d86e2331115ba627e457e347dda94a160567f179
- 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)
- Install
l10n_ar_website_sale; - run
:TestWebsiteSaleProductFilterstest 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: #201433