Skip to content

Commit

Permalink
Merge branch '14.0-fix-base_vat_optional_vies-unavailable' of git+ssh…
Browse files Browse the repository at this point in the history
…://github.com/efatto/account-financial-tools into 14.0
  • Loading branch information
Pretecno committed Jun 23, 2024
2 parents 2b44e6c + d4c44ce commit 98a53cf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions base_vat_optional_vies/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"category": "Accounting",
"version": "14.0.2.1.0",
"depends": ["base_vat"],
"external_dependencies": {"python": ["zeep"]},
"data": [
"views/res_partner_view.xml",
"views/res_config_settings_views.xml",
Expand Down
24 changes: 23 additions & 1 deletion base_vat_optional_vies/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
# Copyright 2022 Moduon - Eduardo de Miguel
# Copyright 2023 Moduon - Emilio Pascual
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models
import logging

from zeep.exceptions import Fault

from odoo import _, api, fields, models, tools

from odoo.addons.base_vat.models.res_partner import _ref_vat

_logger = logging.getLogger(__name__)


class ResPartner(models.Model):
_inherit = "res.partner"
Expand Down Expand Up @@ -56,3 +62,19 @@ def _construct_constraint_msg(self, country_code):
country_code, "'CC##' (CC=Country Code, ##=VAT Number)"
),
)

@api.model
@tools.ormcache("vat")
def _check_vies(self, vat):
# Check for error of connection
try:
return super()._check_vies(vat)
except Fault as error:
if error.args[0] == "MS_MAX_CONCURRENT_REQ":
logging.info(
"VIES VAT check not available at this moment as max concurrency "
"requests has been reached."
)
if error.args[0] == "MS_UNAVAILABLE":
logging.info("VIES VAT check not available at this moment.")
return False
1 change: 0 additions & 1 deletion base_vat_optional_vies/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# generated from manifests external_dependencies
numpy-financial<=1.0.0
numpy>=1.15
zeep

0 comments on commit 98a53cf

Please sign in to comment.