ilru-odoo 86accecf96 [FIX] project_account, project_hr_expense: prevent double counting in project upgrade report
Issue Description:
There is an issue in the project upgrade report where an expense with a related analytic account appears twice. This occurs once as "Expenses" and again as "Vendor Bills". This problem does not manifest on runbot with all apps installed, indicating a specific configuration issue.

The installation of the 'project_purchase' module resolves the issue, as the method "_get_already_included_profitability_invoice_line_ids" within both the "project_purchase" and "project_hr_expense" modules performs a check for an 'expense_sheet_id' in account moves. This check helps to exclude these entries from the profitability items, thereby preventing duplication. However, while this solution is effective, it leads to an undesirable addition of the Purchase app to the client's database, which is not acceptable for the client.
Relevant code sections: [project_hr_expense](https://github.com/odoo/odoo/blob/1fbcfdf69b503e77e1a931d23dd47df0daf8b2fe/addons/project_hr_expense/models/project_project.py#L70), [project_purchase](https://github.com/odoo/odoo/blob/1fbcfdf69b503e77e1a931d23dd47df0daf8b2fe/addons/project_purchase/models/project_project.py#L138C15-L138C15).

Steps to Reproduce:
1. Install Expense, Accounting, Project, Sales, Employees, Contacts apps on base runbot.
2. Create a service product with 'Prepaid/Fixed Price' and ensure 'Create an Order: Project & Task' is selected.
3. Create and confirm a sales order for the service product created in step 2.
4. In the Expenses app, create an employee-paid expense linked to the sales order's analytic account (e.g., Analytic Distribution: Departments > S00074).
5. Follow the process in the Expenses app by clicking on 'Create Report' > 'Submit to Manager' > 'Approve' > 'Post Journal Entries'.
6. Access Project Updates in the Projects app.
7. Observe that in the project profitability cost section, the same expense is listed twice under different labels: once as "Expenses" and once as "Vendor Bills".

Proposed Solution:
The proposed solution involves modifying the domain of the `_add_purchase_items` function within the `project_account` module, specifically at [this code section](https://github.com/odoo/odoo/blob/763f88e2d45cb7ba107db135eecd0365ba2b8c8b/addons/project_account/models/project_project.py#L14). The enhancement would entail adding a condition to the function's domain to exclude any IDs that are already present in the profitability report. This approach will efficiently prevent the double counting of expenses, ensuring that each expense is represented only once in the project profitability report, thereby maintaining accuracy and consistency in financial tracking. This solution focuses on enhancing the existing functionality with a targeted and efficient modification, ensuring minimal impact on other system components while effectively addressing the issue.

opw-3522293

closes odoo/odoo#149623

X-original-commit: 0902d57dd1653018d6ae72554b39e4e01fa4d6d7
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Ilya Rudy (ilru) <ilru@odoo.com>
2024-01-17 00:00:48 +00:00
2023-11-02 21:02:44 +00:00
2024-01-16 09:55:28 +00:00
2024-01-16 22:40:02 +00:00
…
2015-09-08 17:58:38 +02:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%