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
22 lines
758 B
# Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com>
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
from odoo.tests.common import SavepointCase
|
|
from odoo.exceptions import ValidationError
|
|
|
|
|
|
class TestVatUnique(SavepointCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super(TestVatUnique, cls).setUpClass()
|
|
cls.partner = cls.env['res.partner'].create({
|
|
'name': 'Test partner',
|
|
'vat': 'ESA12345674'
|
|
})
|
|
|
|
def test_duplicated_vat_creation(self):
|
|
with self.assertRaises(ValidationError):
|
|
self.env['res.partner'].with_context(test_vat=True).create({
|
|
'name': 'Second partner',
|
|
'vat': 'ESA12345674'
|
|
})
|