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.

39 lines
1.3 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. {
  14. "name": "Homer Simpson",
  15. "city": "Springfield",
  16. "street": "742 Evergreen Terrace",
  17. "street2": "Donut Lane",
  18. "street3": "Tho",
  19. "country_id": us_country.id,
  20. }
  21. )
  22. # test synchro of street3 on create
  23. bart = self.env["res.partner"].create(
  24. {
  25. "name": "Bart Simpson",
  26. "parent_id": homer.id,
  27. "type": "contact",
  28. }
  29. )
  30. self.assertEqual(bart.street3, "Tho")
  31. # test synchro of street3 on write
  32. homer.write({"street3": "in OCA we trust"})
  33. self.assertEqual(bart.street3, "in OCA we trust")