Files
odoo_source/addons/project
Sarah Bellefroid 9dde5a64e9 [FIX] project, hr_timesheet: use correct analytic plan setting
Currently, the `plan_id` used to create analytic accounts is not the one set in the settings.

Steps to reproduce:
-------------------
* Go to the **Settings**
* Enable developper mode
* Select **User & Companies** > **Groups**
* Select `Technical/Analytic Accounting`
* Add user
* Go to the **Project** app
* Select **Configuration** > **Settings**
* Under **Time Management**, enable Timesheets
* Under **Analytics** > **Analytic Plan**, select Projects
* Create a new project
* Go into the settings of the project
* Under the **Settings** tab, select the internal link for the **Analytic Account**
  > **Observation**: The Plan is set to Projects
* Go to **Conffiguration** > **Settings**
* Under **Analytics** > **Analytic Plan**, change Projects to Departments
* Create a new project
* Go into the settings of the project
* Under the **Settings** tab, select the internal link for the **Analytic Account**
  > **Observation**: The Plan is still set to Projects

Why the fix:
------------
When creating, an analytic account, the plan is computed with `_get_all_plans()`.
https://github.com/odoo/odoo/blob/e365e22485dc45f1cbe87ae93395b022a4724a3c/addons/project/models/project_project.py#L894-L903

Inside `__get_all_plans()` the plan is computed as follows:
https://github.com/odoo/odoo/blob/e365e22485dc45f1cbe87ae93395b022a4724a3c/addons/analytic/models/analytic_plan.py#L106-L07

However, the setting that the user changes in the frontend corresponds to `analytic.analytic_plan_projects`.
https://github.com/odoo/odoo/blob/e365e22485dc45f1cbe87ae93395b022a4724a3c/addons/project/models/res_config_settings.py#L18-L22

This seeting is not company-related. It can be used on projects even if they have a `company_id` set to false. We fallback on `_get_all_plans()` if the user did not specifically choose a plan in the settings.

opw-3751661

closes odoo/odoo#157247

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-03-18 16:22:38 +00:00
..
…
…

Project Management

Infinitely flexible. Incredibly easy to use.

Odoo's collaborative and realtime open source project management helps your team get work done. Keep track of everything, from the big picture to the minute details, from the customer contract to the billing.

Designed to Fit Your Own Process

Organize projects around your own processes. Work on tasks and issues using the kanban view, schedule tasks using the gantt chart and control deadlines in the calendar view. Every project may have its own stages, allowing teams to optimize their job.

Easy to Use

Get organized as fast as you can think. The easy-to-use interface takes no time to learn, and every action is instantaneous, so there’s nothing standing between you and your sweet productive flow.

Work Together

Real-time chats, document sharing, email integration

Use the chatter to communicate with your team or customers and share comments and documents on tasks and issues. Integrate discussion fast with the email integration.

Talk to other users or customers with the website live chat feature.

Collaborative Writing

The power of etherpad, inside your tasks

Collaboratively edit the same specifications or meeting minutes right inside the application. The integrated etherpad feature allows several people to work on the same tasks, at the same time.

This is very efficient for scrum meetings, meeting minutes or complex specifications. Every user has their own color and you can replay the whole creation of the content.

Get Work Done

Get alerts on followed events to stay up to date with what interests you. Use instant green/red visual indicators to scan through what has been done and what requires your attention.

Timesheets, Contracts & Invoicing

Projects are automatically integrated with customer contracts, allowing you to invoice based on time & materials and record timesheets easily.

Track Issues

Single out the issues that arise in a project in order to have a better focus on resolving them. Integrate customer interaction on every issue and get accurate reports on your team's performance.