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.

32 lines
1.2 KiB

  1. # Copyright 2017 Tecnativa - Pedro M. Baeza
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo.tests import common
  4. class TestConfig(common.SavepointCase):
  5. @classmethod
  6. def setUpClass(cls):
  7. super(TestConfig, cls).setUpClass()
  8. cls.wizard = cls.env["res.config.settings"].create({})
  9. cls.partner = cls.env["res.partner"].create(
  10. {"firstname": "First", "lastname": "Last", "lastname2": "Second"}
  11. )
  12. def test_last_first(self):
  13. self.wizard.partner_names_order = "last_first"
  14. self.wizard.set_values()
  15. self.wizard.action_recalculate_partners_name()
  16. self.assertEqual(self.partner.name, "Last Second First")
  17. def test_last_first_comma(self):
  18. self.wizard.partner_names_order = "last_first_comma"
  19. self.wizard.set_values()
  20. self.wizard.action_recalculate_partners_name()
  21. self.assertEqual(self.partner.name, "Last Second, First")
  22. def test_first_last(self):
  23. self.wizard.partner_names_order = "first_last"
  24. self.wizard.set_values()
  25. self.wizard.action_recalculate_partners_name()
  26. self.assertEqual(self.partner.name, "First Last Second")