2
0
account-financial-tools/account_template_active/tests/test_module.py
Sylvain LE GAL da416248ac [MIG] account_template_active from 14.0 to 16.0
- use new web_ribbon widget to display archived items on form views
- change inheritance from account to account_usability regarding views that disappeared in V16
2023-01-19 17:24:20 +01:00

92 lines
3.1 KiB
Python

# Copyright (C) 2020 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class TestModule(TransactionCase):
def setUp(self):
super().setUp()
self.ACTemplate = self.env["account.chart.template"]
self.AATemplate = self.env["account.account.template"]
self.ATTemplate = self.env["account.tax.template"]
self.AFPTemplate = self.env["account.fiscal.position.template"]
self.AFPATemplate = self.env["account.fiscal.position.account.template"]
self.AFPTTemplate = self.env["account.fiscal.position.tax.template"]
self.template = self.ACTemplate.create(
{
"name": "Chart of Account",
"bank_account_code_prefix": "BNK",
"cash_account_code_prefix": "CSH",
"transfer_account_code_prefix": "TRSF",
"currency_id": self.env.ref("base.EUR").id,
}
)
self.account_template = self.AATemplate.create(
{
"name": "Account Template",
"code": "CODE",
"account_type": "asset_receivable",
"chart_template_id": self.template.id,
}
)
self.tax_template = self.ATTemplate.create(
{
"name": "Tax Template",
"chart_template_id": self.template.id,
"amount": 10.0,
}
)
self.fiscal_position = self.AFPTemplate.create(
{
"name": "Fiscal Position",
"chart_template_id": self.template.id,
}
)
self.fiscal_position_account = self.AFPATemplate.create(
{
"account_src_id": self.account_template.id,
"account_dest_id": self.account_template.id,
"position_id": self.fiscal_position.id,
}
)
self.fiscal_position_tax = self.AFPTTemplate.create(
{
"tax_src_id": self.tax_template.id,
"position_id": self.fiscal_position.id,
}
)
def test_tax_template(self):
self.tax_template.active = False
self.assertEqual(
self.fiscal_position_tax.active,
False,
"Disable Tax template should disable Fiscal Position Tax",
)
self.fiscal_position_tax.active = True
self.assertEqual(
self.tax_template.active,
True,
"Enable Fiscal Position Tax should enable Tax Template",
)
def test_account_template(self):
self.account_template.active = False
self.assertEqual(
self.fiscal_position_account.active,
False,
"Disable Account template should disable Fiscal Position Account",
)
self.fiscal_position_account.active = True
self.assertEqual(
self.account_template.active,
True,
"Enable Fiscal Position Account should enable Account Template",
)