Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] base: company branches: archive all sub-branches when archiving a company #163080

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Apr 24, 2024

Original issue:

  1. Create a company "main", with 2 branches: "A" and "B" 2) Create a sub-branch for "A": "A1"
  2. Archive company A
  3. 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

Forward-Port-Of: #162638

… 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

X-original-commit: b5f2976
@robodoo
Copy link
Contributor

robodoo commented Apr 24, 2024

Pull request status dashboard.

@fw-bot
Copy link
Contributor Author

fw-bot commented Apr 24, 2024

This PR targets saas-17.1 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Apr 24, 2024
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Apr 24, 2024
robodoo pushed a commit that referenced this pull request Apr 24, 2024
… 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 #163080

X-original-commit: b5f2976
Signed-off-by: William André (wan) <wan@odoo.com>
@robodoo robodoo closed this Apr 24, 2024
@fw-bot fw-bot deleted the saas-17.1-saas-16.4-fix-branch-archiving-oco-qdPo-fw branch May 8, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwardport This PR was created by @fw-bot OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants