odoo/odoo#149490

Created by fw-bot
Merged at fe8f9b7846ad0c9295027ae93d4ce5f77f337bdb

Statuses:

label
odoo-dev:master-saas-16.4-opw-3629683-fix-agr-TI8_-fw
head
85f378b82447e30d12aae00af84aa49978f97610
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