odoo/odoo#149436

Created by fw-bot
Merged at ccac158b3988f04d89fac135d8c45d70b77c2553

Statuses:

label
odoo-dev:saas-17.1-saas-16.4-opw-3629683-fix-agr-BzpR-fw
head
9f81fc9675e1c3bf787317b8e0dfdfe23b5ee380
merged
1 year ago by Bugfix, Andrea Grazioso (agr)
odoo/odoo
saas-16.4 #149061
17.0 #149410
saas-17.1 #149436
18.0
saas-18.1
saas-18.2
saas-18.3
master #149490

[FW][FIX] point_of_sale: force company of pos order in controller

Have company 1 (main company) and company 2
Activate Website for company 1
Switch to company 2
Setup a POS
In Settings > Point of Sale, activate 'Use QR code on ticket' Open POS session
Make an order, save qr link from receipt, close session Open the saved link without being logged in
Complete form and request invoice

Issue:
Error will block the operation

Incompatible companies on records:
- '/ (Reversal of POS closing entry POSS/2024/01/0004 for order Shop/0004 from session POS/00002) 16%' belongs to company False and 'Account' (account_id: '209.01.01 VAT carried forward not collected') belongs to another company.
- '/ (Reversal of POS closing entry POSS/2024/01/0004 for order Shop/0004 from session POS/00002) 16%' belongs to company False and 'Originator Tax Distribution Line' (tax_repartition_line_id: 'account.tax.repartition.line,54') belongs to another company.
- '/ (Reversal of POS closing entry POSS/2024/01/0004 for order Shop/0004 from session POS/00002) Acoustic Bloc Screens' belongs to company False and 'Account' (account_id: '401.01.01 Sales and/or services taxed at the general rate') belongs to another company.
- '/ (Reversal of POS closing entry POSS/2024/01/0004 for order Shop/0004 from session POS/00002) Acoustic Bloc Screens' belongs to company False and 'Taxes' (tax_ids: '16% (MX)') belongs to another company.
- '/ (Reversal of POS closing entry POSS/2024/01/0004 for order Shop/0004 from session POS/00002) 105.01.02 105.01.02' belongs to company False and 'Account' (account_id: '105.01.02 National customers (PoS)') belongs to another company.

This occurs because when Website is installed, requests from public user will keep in context the id of the company associated to the website, company 1 in this case.

opw-3629683

Forward-Port-Of: #149061