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.

45 lines
1.5 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014 Nicolas Bessi, Alexandre Fayolle, Camptocamp SA
  3. # Copyright 2016 Sodexis
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  5. import openerp.tests.common as test_common
  6. from ..hooks import uninstall_hook
  7. class TestStreet3(test_common.TransactionCase):
  8. def test_partner(self):
  9. """"Test address_format has been updated on existing countries"""
  10. us_country = self.env.ref('base.us')
  11. self.assertTrue('%(street3)s' in us_country.address_format)
  12. homer = self.env['res.partner'].create({
  13. 'name': 'Homer Simpson',
  14. 'city': 'Springfield',
  15. 'street': '742 Evergreen Terrace',
  16. 'street2': 'Donut Lane',
  17. 'street3': 'Tho',
  18. 'country_id': us_country.id,
  19. })
  20. # test synchro of street3 on create
  21. bart = self.env['res.partner'].create({
  22. 'name': 'Bart Simpson',
  23. 'parent_id': homer.id,
  24. 'type': 'contact',
  25. })
  26. self.assertEquals(bart.street3, 'Tho')
  27. # test synchro of street3 on write
  28. homer.write({'street3': 'in OCA we trust'})
  29. self.assertEquals(bart.street3, 'in OCA we trust')
  30. def test_uninstall_hook(self):
  31. """"Test uninstall_hook"""
  32. us_country = self.env.ref('base.us')
  33. self.assertTrue('%(street3)s' in us_country.address_format)
  34. uninstall_hook(self.cr, self.registry)
  35. us_country.invalidate_cache()
  36. self.assertTrue('%(street3)s' not in us_country.address_format)