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

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