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.

23 lines
782 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo.tests.common import SavepointCase
  5. from odoo.exceptions import ValidationError
  6. class TestVatUnique(SavepointCase):
  7. @classmethod
  8. def setUpClass(cls):
  9. super(TestVatUnique, cls).setUpClass()
  10. cls.partner = cls.env['res.partner'].create({
  11. 'name': 'Test partner',
  12. 'vat': 'ESA12345674'
  13. })
  14. def test_duplicated_vat_creation(self):
  15. with self.assertRaises(ValidationError):
  16. self.env['res.partner'].with_context(test_vat=True).create({
  17. 'name': 'Second partner',
  18. 'vat': 'ESA12345674'
  19. })