[FIX] website_sale: check email address

Partial backport of ef19830. The error message cannot be included for
compatibility reason, but the browser will highlight the field in red,
which should be enough to locate the error.

opw-677121
This commit is contained in:
Nicolas Martinelli 2016-06-13 14:08:26 +02:00
parent d43d1ddf4b
commit 6817c48a8b
1 changed files with 5 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import werkzeug
from openerp import SUPERUSER_ID
from openerp import http
from openerp import tools
from openerp.http import request
from openerp.tools.translate import _
from openerp.addons.website.models.website import slug
@ -533,6 +534,10 @@ class website_sale(http.Controller):
if not data.get(field_name):
error[field_name] = 'missing'
# email validation
if data.get('email') and not tools.single_email_re.match(data.get('email')):
error["email"] = 'error'
if data.get("vat") and hasattr(registry["res.partner"], "check_vat"):
if request.website.company_id.vat_check_vies:
# force full VIES online check