summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2014-05-27 14:35:07 +0200
committerChristophe Matthieu <chm@odoo.com>2014-05-27 14:35:07 +0200
commit2efb07473326d6fb1eefae00e6ebaac40cce3f5f (patch)
tree67f09faf2d3233bbf70f7278827e922c59371c56
parent59be055c3718aede3f1d2262483a5279f52c84ba (diff)
[IMP] website_sale: use company vat_check_vies field to select the method to check the vat id base_vat is installed
-rw-r--r--addons/website_sale/controllers/main.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py
index c645943917b..2ef442a4e3b 100644
--- a/addons/website_sale/controllers/main.py
+++ b/addons/website_sale/controllers/main.py
@@ -356,8 +356,14 @@ class website_sale(http.Controller):
error[field_name] = 'missing'
if data.get("vat") and hasattr(registry["res.partner"], "check_vat"):
+ if request.website.company_id.vat_check_vies:
+ # force full VIES online check
+ check_func = registry["res.partner"].vies_vat_check
+ else:
+ # quick and partial off-line checksum validation
+ check_func = registry["res.partner"].simple_vat_check
vat_country, vat_number = registry["res.partner"]._split_vat(data.get("vat"))
- if not registry["res.partner"].vies_vat_check(cr, uid, vat_country, vat_number, context=None): # simple_vat_check
+ if not check_func(cr, uid, vat_country, vat_number, context=None): # simple_vat_check
error["vat"] = 'error'
if data.get("shipping_different"):