[FIX] base_vat: display error from VIES service
Steps to reproduce: - Activate "Verify VAT Numbers" option in the Settings - Go to Contacts and create a new one - Enter a valid EU VAT Number Issue: It happens that VIES service could not process the VAT number for some reason and returns an error. That error is silently caught without notification to user and "Intra-Community Valid" field is set to False. The user will wrongly think that the VAT number is not valid, but it hasn't been processed at all. Here's the list of the potential errors returned by VIES service: - INVALID_INPUT - INVALID_REQUESTER_INFO - SERVICE_UNAVAILABLE - MS_UNAVAILABLE - TIMEOUT - VAT_BLOCKED - IP_BLOCKED - GLOBAL_MAX_CONCURRENT_REQ - GLOBAL_MAX_CONCURRENT_REQ_TIME - MS_MAX_CONCURRENT_REQ - MS_MAX_CONCURRENT_REQ_TIME Solution: Log a note with the error (as it is done for some other error) to warn the user that the VAT number hasn't been processed. opw-3687968 closes odoo/odoo#155525 X-original-commit: a15e5430d46b48821f062ffe07fd979b2f19a234 Signed-off-by: Florian Gilbert (flg) <flg@odoo.com> Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
This commit is contained in:
@@ -108,6 +108,15 @@ msgid ""
|
||||
"on this fiscal position."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The request for VAT validation was not processed. VIES service has responded"
|
||||
" with the following error: %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
|
||||
@@ -213,6 +213,8 @@ class ResPartner(models.Model):
|
||||
msg = _("Connection with the VIES server failed. The VAT number %s could not be validated.", partner.vies_vat_to_check)
|
||||
elif isinstance(e, InvalidComponent):
|
||||
msg = _("The VAT number %s could not be interpreted by the VIES server.", partner.vies_vat_to_check)
|
||||
elif isinstance(e, zeep.exceptions.Fault):
|
||||
msg = _('The request for VAT validation was not processed. VIES service has responded with the following error: %s', e.message)
|
||||
partner._origin.message_post(body=msg)
|
||||
_logger.warning("The VAT number %s failed VIES check.", partner.vies_vat_to_check)
|
||||
partner.vies_valid = False
|
||||
|
||||
Reference in New Issue
Block a user