Skip to content
Snippets Groups Projects
Commit d46befdf authored by Nans Lefebvre's avatar Nans Lefebvre
Browse files

[FIX] account: add a test on settings change


Because of f206714a and subsequent commits, adding groups may raise.
We ensure that switching between tax included and tax excluded keeps working.

Closes #37481

closes odoo/odoo#37633

Forward-port-of: #37517
Signed-off-by: default avatarNans Lefebvre (len) <len@odoo.com>
parent a2293953
Branches
Tags
No related merge requests found
......@@ -14,6 +14,7 @@ from . import test_reconciliation_widget
from . import test_payment
from . import test_reconciliation
from . import test_search
from . import test_settings
from . import test_tax
from . import test_invoice_taxes
from . import test_templates_consistency
......
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.tests import tagged
@tagged('post_install', '-at_install')
class TestSettings(AccountingTestCase):
def test_switch_taxB2B_taxB2C(self):
"""
Since having users both in the tax B2B and tax B2C groups raise,
modifications of the settings must be done in the right order;
otherwise it is impossible to change the settings.
"""
# at each setting change, all users should be removed from one group and added to the other
# so picking an arbitrary witness should be equivalent to checking that everything worked.
config = self.env['res.config.settings'].create({})
config.show_line_subtotals_tax_selection = "tax_excluded"
config._onchange_sale_tax()
config.flush()
config.execute()
self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_excluded'), True)
self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_included'), False)
config.show_line_subtotals_tax_selection = "tax_included"
config._onchange_sale_tax()
config.flush()
config.execute()
self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_excluded'), False)
self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_included'), True)
config.show_line_subtotals_tax_selection = "tax_excluded"
config._onchange_sale_tax()
config.flush()
config.execute()
self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_excluded'), True)
self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_included'), False)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment