odoo/odoo#149061

Created by Bugfix, Andrea Grazioso (agr)
Merged at 6fce2e5bf34468099a0c62669687847ed36621bf

Statuses:

label
odoo-dev:saas-16.4-opw-3629683-fix-agr
head
bfe73b4678ff1133e86c24774462f75acb9e5495
merged
1 year ago by POS IoT, Joseph Caburnay (jcb)
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

[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