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.

22 lines
758 B

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