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.

34 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",
  11. 'lastname': "Last",
  12. 'lastname2': "Second",
  13. })
  14. def test_last_first(self):
  15. self.wizard.partner_names_order = 'last_first'
  16. self.wizard.set_values()
  17. self.wizard.action_recalculate_partners_name()
  18. self.assertEqual(self.partner.name, "Last Second First")
  19. def test_last_first_comma(self):
  20. self.wizard.partner_names_order = 'last_first_comma'
  21. self.wizard.set_values()
  22. self.wizard.action_recalculate_partners_name()
  23. self.assertEqual(self.partner.name, "Last Second, First")
  24. def test_first_last(self):
  25. self.wizard.partner_names_order = 'first_last'
  26. self.wizard.set_values()
  27. self.wizard.action_recalculate_partners_name()
  28. self.assertEqual(self.partner.name, "First Last Second")