Skip to content

Commit

Permalink
[PERF] base_vat: avoid vies check on child partner with same vat
Browse files Browse the repository at this point in the history
Follow up of odoo#178219

The vies check service may limit ip addresses when:
- checking too many vat numbers per day
- checking the same vat number multiple times
- checking too many invalid number

This is to avoid the second case

closes odoo#182928

X-original-commit: c677169
Signed-off-by: Louis Baudoux (lba) <[email protected]>
Signed-off-by: Stanislas Sobieski (sts) <[email protected]>
  • Loading branch information
sts-odoo committed Oct 16, 2024
1 parent 4d19c93 commit 5b4d4ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addons/base_vat/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ def _compute_vies_valid(self):
if not partner.vies_vat_to_check:
partner.vies_valid = False
continue
if partner.parent_id and partner.parent_id.vies_vat_to_check == partner.vies_vat_to_check:
partner.vies_valid = partner.parent_id.vies_valid
continue
try:
vies_valid = check_vies(partner.vies_vat_to_check, timeout=10)
partner.vies_valid = vies_valid['valid']
Expand Down

0 comments on commit 5b4d4ab

Please sign in to comment.