odoo/odoo#193240

Created by fw-bot
Merged at 739ad9347ac23a4b067b0d911c3ab38eeb199a4b

Statuses:

label
odoo-dev:master-18.0-opw-4450588-remove_archived_companies_from_account_code_mapping-pta-EVyA-fw
head
63baa5d7024f46212ecd213f8b79eedf90c20b49
merged
6 months ago by Bugfix, Anh Thao Pham (pta)
odoo/odoo
18.0 #193094
saas-18.1 #193218
saas-18.2
saas-18.3
saas-18.4
master #193240

[FW][FIX] account: fix account opening from CoA with archived branches

Steps to reproduce:
- Install Accounting
- Create a branch
- Archive the branch
- Go to "Accounting / Configuration / Accounting / Chart of Accounts"
- Click on the "View" button of any account

Issue:
An AccessError is raised:
"Access to unauthorized or invalid companies."

Cause:
The "account.code.mapping" records are fetched for all the companies of the current user, even the archived ones.
{'active_test': False} is added in the context in the read method of the One2many class in fields.py

opw-4450588


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #193094