odoo/odoo#192959

Created by fw-bot
Merged at 3b82c4b4d88f353aaae252b72d5d1f07dfc7e069

Statuses:

label
odoo-dev:saas-17.2-17.0-currency_access_child_comp-arsi-jvws-fw
head
fd0d5f546c015176b629f9b0689b5c5ae40f22a8
merged
9 months ago by Accounting, William André (wan)
odoo/odoo
17.0 #192632
saas-17.2 #192959
saas-17.4 #192970
18.0 #192982
saas-18.1 #193627
saas-18.2
saas-18.3
saas-18.4
19.0
master #193810

[FW][FIX] base: fix access error to currencies when in child company

Steps to reproduce (db with Accounting installed):
- create a child company
- give a user (e.g. Marc Demo) access to the child company, set
their "Accounting" rights to "Accountant" and "Administration" to None.
- log as this user and select only the child company in the company
selector.
- try to access "Accounting/Configuration/Accounting/Currencies"
-> Access Error

It is happening as in the res.currency model, several methods try to
access the root company, but there's only the child company in
allowed_company_ids from the context.

The fix here is to:
1) When accessing the root company in order the get its currency, just
access the currency of the child company, as it is the same.
2) Use sudo when accessing other fields from the root company.

opw-4352595

Forward-Port-Of: #192632