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.

33 lines
1.2 KiB

6 years ago
  1. # SDi
  2. # Copyright 2018 David Juaneda - <djuaneda@sdi.es>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo.tests.common import TransactionCase
  5. class TestResPartnerNav(TransactionCase):
  6. def setUp(self):
  7. super(TestResPartnerNav, self).setUp()
  8. res_partner = self.env['res.partner']
  9. self.parent = res_partner.browse(
  10. res_partner.name_create('IronShield')[0])
  11. self.child = res_partner.create({
  12. 'name': 'Isen Hardearth',
  13. 'street': 'Strongarm Avenue, 12',
  14. 'parent_id': self.parent.id,
  15. })
  16. def test_open_commercial_partner(self):
  17. """ This test case checks
  18. - If the method redirects to the form view of the correct one
  19. of an object of the 'res.partner' class.
  20. """
  21. for child in self.parent.child_ids:
  22. action = child.open_commercial_partner()
  23. print("Child_id = {}".format(child.id))
  24. print("action.get('res_id') = {}".format(action.get('res_id')))
  25. self.assertEqual(child.id, action.get('res_id'),
  26. 'The contact ID from the partner must be equal to'
  27. ' the ID of the contact to be displayed.')