odoo/odoo#200355

Created by fw-bot
Merged at 186d8e972257307290e14d3d00ad890439148f70

Statuses:

label
odoo-dev:17.0-16.0-account-prevent-deprecating-account-in-tax-distribution-loug-415857-fw
head
9d02cacafef9fceeda1d48a1a1ce6c2d1ac03ca4
merged
3 months ago by Training, Louis Gobert (loug)
odoo/odoo
16.0 #197521
17.0 #200355
saas-17.4 #200380
18.0 #200396
saas-18.1 #201336
saas-18.2 #201366
saas-18.3
master #201398

[FW][FIX] account: prevent deprecating accounts used in tax distribution

This commit adds a check to prevent deprecating an account that is used in tax distribution lines.

It serves as an indirect fix to avoid future issues in other contexts. For example, in the Italian EDI flow, if an XML bill includes a tax with a distribution line linked to a deprecated account, an error will be raised by the following code: https://github.com/odoo/odoo/blob/cc3a060e67a2f1015ea02b589dcf6a7e7eff1e90/addons/account/models/account_move_line.py#L1478 This commit aims to minimize such issues by preventing them as early as possible.

Steps to reproduce:
- Try to deprecate an account that is used in tax distribution lines.

Forward-Port-Of: #197521