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.

36 lines
1.2 KiB

  1. # Copyright 2014-2020 Camptocamp SA
  2. # @author: Nicolas Bessi
  3. # Copyright 2016-2020 Akretion (http://www.akretion.com/)
  4. # @author: Alexis de Lattre <alexis.delattre@akretion.com>
  5. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  6. from odoo.tests.common import TransactionCase
  7. class TestStreet3(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.assertEqual(bart.street3, 'Tho')
  27. # test synchro of street3 on write
  28. homer.write({'street3': 'in OCA we trust'})
  29. self.assertEqual(bart.street3, 'in OCA we trust')