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

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2015 ACSONE SA/NV (<http://acsone.eu>).
  3. # Copyright 2016 Tecnativa - Vicent Cubells
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. import openerp.tests.common as common
  6. class TestBasePartnerSequence(common.TransactionCase):
  7. def setUp(self):
  8. super(TestBasePartnerSequence, self).setUp()
  9. self.res_partner = self.env['res.partner']
  10. self.partner = self.res_partner.create({
  11. 'name': "test1",
  12. 'email': "test@test.com"})
  13. def test_ref_sequence_on_partner(self):
  14. # Test sequence on creating partner and copying it
  15. self.assertTrue(self.partner.ref, "A partner has always a ref.")
  16. copy = self.partner.copy()
  17. self.assertTrue(copy.ref, "A partner with ref created by copy "
  18. "has a ref by default.")
  19. def test_ref_sequence_on_contact(self):
  20. # Test if sequence doesn't increase on creating a contact child
  21. contact = self.res_partner.create({
  22. 'name': "contact1",
  23. 'email': "contact@contact.com",
  24. 'parent_id': self.partner.id})
  25. self.assertEqual(
  26. self.partner.ref, contact.ref, "All it's ok as sequence doesn't "
  27. "increase.")