odoo/odoo#228707
Created by fw-bot
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- ci/documentation: (runtime 661s)
- label
- odoo-dev:saas-18.2-18.0-fix_so_project_update_with_removed_analytic_account-459732-fw
- head
- 4ce1f8273a27f4091295d57f7c678d52a4708496
- merged
- 8 months ago by Fun Services, Xavier Bol (xbo)
| odoo/odoo | |
|---|---|
| 18.0 | #224895 |
| saas-18.2 | #228707 |
| saas-18.3 | #228732 |
| saas-18.4 | #228757 |
| 19.0 | #228788 |
| saas-19.1 | |
| saas-19.2 | |
| saas-19.3 | |
| master | #228988 |
[FIX] sale_project: Clear deleted analytic accounts from so lines
Issue:
In a sale order, if any of the so lines contains the ID of a deleted analytic account in its analytic_distribution field, then updating the project_id field is impossible as it raises an error.
Cause
This is caused because _compute_analytic_distribution() tries to retrieve 'root_plan_id' from all ids without checking if records exists.
Fix
This commit add an exists() check on analytic.accounts retrieved from analytic_distribution field and clear the non-existing records ids from the field.
Steps to reproduce
- Install sale_project and accountant modules
- Check "Analytic Accounting" in the Accounting settings
- Create a new project "Test P", set it up "Billable", with a new Analytic account "Test AC" (field "Project" tab "Analytic")
- Create a new sale order "Test SO", add a few products and set up the Project field to "Test P". Save the sale order.
- Delete the analytic.account "Test AC"
- Go back on "Test SO", try to change the field "Project" - a Missing error is thrown
Current behavior before PR: When creating a sale order and binding it to a project with an analytic account, then deleting the analytic account, the field "Project" on the sale order can't be updated anymore.
Desired behavior after PR is merged: When creating a sale order and binding it to a project with an analytic account, then deleting the analytic account, the field "Project" on the sale order can be updated.
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #224895