[IMP] account_financial_report: Open items groupy by salesman

TT49193
This commit is contained in:
Carolina Fernandez
2024-05-22 13:38:05 +02:00
committed by Víctor Martínez
parent c81cfc0f98
commit e14373d995
10 changed files with 438 additions and 93 deletions

View File

@@ -1,7 +1,9 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.fields import Date
from odoo.tests import tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -22,6 +24,14 @@ class TestOpenItems(AccountTestInvoicingCommon):
tracking_disable=True,
)
)
cls.account001 = cls.env["account.account"].create(
{
"code": "001",
"name": "Account 001",
"account_type": "income_other",
"reconcile": True,
}
)
def test_partner_filter(self):
partner_1 = self.env.ref("base.res_partner_1")
@@ -39,3 +49,23 @@ class TestOpenItems(AccountTestInvoicingCommon):
wizard = self.env["open.items.report.wizard"].with_context(**context)
self.assertEqual(wizard._default_partners(), expected_list)
def test_open_items_grouped_by(self):
open_item_wizard = self.env["open.items.report.wizard"]
all_accounts = self.env["account.account"].search(
[
("reconcile", "=", True),
],
order="code",
)
wizard = open_item_wizard.create(
{
"date_at": Date.today(),
"account_code_from": self.account001.id,
"account_code_to": all_accounts[-1].id,
"grouped_by": "salesperson",
}
)
wizard.on_change_account_range()
res = wizard._prepare_report_open_items()
self.assertEqual(res["grouped_by"], wizard.grouped_by)