The goal of this commit is to get rid of the analytic tags as they were confusing, serving tag purposes as well as distribution on analytic accounts. Everywhere analytic tags were used as a distribution have been replaced with a new widget that will dispatch distribution on analytic accounts. If there was an analytic account field next to the tags, it has been included in the distribution. Analytic tags that were used simply as information tags have been removed. To fill the new widget, there are now 2 kind of rules that will help fill and prefill it. The first are applicability: previous groups have been removed, and have by replaced by plans. Each account is required to have a plan. These plans define when they are available in the widget: a default applicability per plan and applicability lines that can specify rules following the context of the widget. The second one are distribution models, that will replace previous default rules but follow the same principles. The accounts (and so the plans) that will be given by the distribution model can override the applicability rules from before. closes odoo/odoo#98914 Related: odoo/upgrade#3885 Related: odoo/enterprise#30743 Signed-off-by: William André (wan) <wan@odoo.com> Co-authored-by: Habib (ayh) <ayh@odoo.com>
54 lines
2.0 KiB
Python
54 lines
2.0 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.
|
|
"""
|
|
profitability_items = self.project._get_profitability_items(False)
|
|
self.assertDictEqual(
|
|
profitability_items,
|
|
self.project_profitability_items_empty,
|
|
'The profitability data of the project should be return no data and so 0 for each total amount.'
|
|
)
|