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.

36 lines
1.2 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'].sudo(self.account_user)
  15. def test_groups(self):
  16. conf = self.config.create({
  17. "default_aging_type": "months",
  18. "group_activity_statement": True,
  19. "group_outstanding_statement": False,
  20. })
  21. conf.set_values()
  22. self.assertFalse(self.user_obj._has_group(
  23. 'partner_statement.group_outstanding_statement')
  24. )
  25. self.assertTrue(self.user_obj._has_group(
  26. 'partner_statement.group_activity_statement')
  27. )
  28. res = self.env['ir.default'].get(
  29. 'activity.statement.wizard', 'aging_type'
  30. )
  31. self.assertEquals(res, 'months')