[FIX] website_portal: check optional field
This commit is contained in:
@@ -60,6 +60,7 @@ class website_account(http.Controller):
|
||||
error_message = []
|
||||
|
||||
mandatory_billing_fields = ["name", "phone", "email", "street2", "city", "country_id"]
|
||||
optional_billing_fields = ["zipcode", "state_id", "vat", "street"]
|
||||
|
||||
# Validation
|
||||
for field_name in mandatory_billing_fields:
|
||||
@@ -86,4 +87,9 @@ class website_account(http.Controller):
|
||||
if [err for err in error.values() if err == 'missing']:
|
||||
error_message.append(_('Some required fields are empty.'))
|
||||
|
||||
unknown = [k for k in data.iterkeys() if k not in mandatory_billing_fields + optional_billing_fields]
|
||||
if unknown:
|
||||
error['common'] = 'Unknown field'
|
||||
error_message.append("Unknown field '%s'" % ','.join(unknown))
|
||||
|
||||
return error, error_message
|
||||
|
||||
Reference in New Issue
Block a user