Files
odoo_source/addons/project/tests/test_project_profitability.py
T
damr 5ad0aa5c2a [IMP] project,web_form_project : add the handling of AAL for
project_profitability + change the name displayed in portal

This commit's purpose is to
- add the computation of the AAL for the project profitabity. If a the
analytic account of a project contains AAL that were manually added (
and thus not linked to any sol/purchase/etc ) those lines are not
computed in the 'other costs/other revenues section.

- to display the title of the ticket/task/project in the name of the page My ticket/My task/My project of the portal

task-2960753

closes odoo/odoo#106438

Related: odoo/enterprise#34344
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 17:20:44 +02:00

53 lines
1.9 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import TransactionCase
class TestProjectProfitabilityCommon(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partner = cls.env['res.partner'].create({
'name': 'Georges',
'email': 'georges@project-profitability.com'})
cls.analytic_plan = cls.env['account.analytic.plan'].create({
'name': 'Plan A',
'company_id': False,
})
cls.analytic_account = cls.env['account.analytic.account'].create({
'name': 'Project - AA',
'code': 'AA-1234',
'plan_id': cls.analytic_plan.id,
})
cls.project = cls.env['project.project'].with_context({'mail_create_nolog': True}).create({
'name': 'Project',
'partner_id': cls.partner.id,
'analytic_account_id': cls.analytic_account.id,
})
cls.task = cls.env['project.task'].with_context({'mail_create_nolog': True}).create({
'name': 'Task',
'project_id': cls.project.id,
})
cls.project_profitability_items_empty = {
'revenues': {'data': [], 'total': {'invoiced': 0.0, 'to_invoice': 0.0}},
'costs': {'data': [], 'total': {'billed': 0.0, 'to_bill': 0.0}},
}
class TestProfitability(TestProjectProfitabilityCommon):
def test_project_profitability(self):
""" Test the project profitability has no data found
In this module, the project profitability should have no data.
So the no revenue and cost should be found.
"""
self.assertDictEqual(
self.project._get_profitability_items(False),
self.project_profitability_items_empty,
'The profitability data of the project should be return no data and so 0 for each total amount.'
)