# Impacted versions:
10.0

# Steps to reproduce:
Create 2 companies:

- Company A and check VIES VAT Check
- Company B and do not check VIES VAT Check

Set current company of admin user to Company A and do not allow Company B
Create a demo user on Company B and give him Adviser group in Accounting.

Log in with the demo user.
Create a Customer A as a company with:
- country = Spain
- TIN = 85847955H

Create a contact on Customer A: "Contact Sample"
Create a Customer invoice on "Contact Sample" partner

Through the menu Accounting/Payments, create a new payment on "Contact Sample" partner with the total amount of the invoice.

Open the menu Manual Payments and invoicing matching. The invoice and the payment should be proposed for reconciliation. Do CTRL+ENTER.

# Current behavior:

An error message appears: The VAT number [85847955H] for partner [Contact Sample] either failed the VIES VAT validation check or did not respect the expected format ESA12345674.

# Expected behavior:

This message should not appear as the current user is on Company B which doesn't have the flag "VIES VAT Check" checked.


import datetime
import logging
import string
import re
_logger = logging.getLogger(__name__)
try:
    import vatnumber
except ImportError:
    _logger.warning("VAT validation partially unavailable because the `vatnumber` Python library cannot be found. "
                    "Install it to support more countries, for example with `easy_install vatnumber`.")
    vatnumber = None
from odoo import api, models, _
from odoo.tools.misc import ustr
from odoo.exceptions import ValidationError
_ref_vat = {
    'at': 'ATU12345675',
    'be': 'BE0477472701',
    'bg': 'BG1234567892',
    'ch': 'CHE-123.456.788 TVA or CH TVA 123456',  
    'cy': 'CY12345678F',
    'cz': 'CZ12345679',
    'de': 'DE123456788',
    'dk': 'DK12345674',