You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.3 KiB

  1. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  2. from odoo.tests.common import TransactionCase
  3. class TestResConfigSettings(TransactionCase):
  4. def setUp(self):
  5. super().setUp()
  6. self.config = self.env["res.config.settings"]
  7. self.cr.execute(
  8. "SELECT uid FROM res_groups_users_rel "
  9. "WHERE gid IN (SELECT res_id FROM ir_model_data "
  10. " WHERE module='account' AND name='group_account_invoice') "
  11. "ORDER BY uid DESC LIMIT 1"
  12. )
  13. self.account_user = self.cr.fetchone()[0]
  14. self.user_obj = self.env["res.users"].with_user(self.account_user)
  15. def test_groups(self):
  16. conf = self.config.create(
  17. {
  18. "default_aging_type": "months",
  19. "group_activity_statement": True,
  20. "group_outstanding_statement": False,
  21. }
  22. )
  23. conf.set_values()
  24. self.assertFalse(
  25. self.user_obj._has_group("partner_statement.group_outstanding_statement")
  26. )
  27. self.assertTrue(
  28. self.user_obj._has_group("partner_statement.group_activity_statement")
  29. )
  30. res = self.env["ir.default"].get("activity.statement.wizard", "aging_type")
  31. self.assertEquals(res, "months")