Files
odoo_source/odoo
oco-odoo 436be43d49 [FIX] base: company branches: archive all sub-branches when archiving a company
Original issue:

1) Create a company "main", with 2 branches: "A" and "B"
2) Create a sub-branch for "A": "A1"
3) Archive company A
4) In the company selector, make "main" the active company. It will auto-select branch B as well.
5) Open the tax report, and try clicking the "Closing Entry" button
==> The button is disabled ; it shouldn't be.

This happens because Odoo considers the full hierachy of branches to submit together is not selected. The problem originates in the way _get_branches_with_same_vat searches for sub-branches, doing

self.env['res.company'].sudo().search([('id', 'child_of', current.root_id.ids)])

In our example, this search will return main, B and A1. We then compare that with the company selector, which only contains main and B.

This configuration of companies does not make sense functionally speaking, as a branch whose parent is inactive will not be usable anyway. Therefore, we now archive all the sub-branches when archiving a company.

opw-3877368
task-3878070

closes odoo/odoo#163078

X-original-commit: b5f297616e937535f2d0ba3f05fd905858741d53
Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-24 09:28:17 +00:00
..
…
…
…
…
…