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.4 KiB

  1. # Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo.tests.common import SavepointCase
  4. class TestConfigSettings(SavepointCase):
  5. @classmethod
  6. def setUpClass(cls):
  7. super().setUpClass()
  8. cls.config = cls.env["res.config.settings"].create({})
  9. def _change_partner_names_order(self):
  10. orders = [o[0] for o in self.config._partner_names_order_selection()]
  11. current = new = self.config.partner_names_order
  12. for o in orders:
  13. if o != current:
  14. new = o
  15. break
  16. self.config.partner_names_order = new
  17. def test_partner_names_order_changed(self):
  18. # The partner_names_order_changed is set to true at save time when
  19. # the value of partner_names_order is updated
  20. self.assertFalse(self.config.partner_names_order_changed)
  21. self._change_partner_names_order()
  22. self.assertTrue(self.config.partner_names_order_changed)
  23. def test_partner_names_order_changed_reset(self):
  24. # The partner_names_order_changed is reset to false when
  25. # the action action_recalculate_partners_name is executed
  26. self._change_partner_names_order()
  27. self.assertTrue(self.config.partner_names_order_changed)
  28. self.config.action_recalculate_partners_name()
  29. self.assertFalse(self.config.partner_names_order_changed)