Browse Source

[FIX] Show field error

14.0-MIG-INITIAL
default 3 years ago
parent
commit
7aca3f2051
  1. 4
      easy_my_coop/models/coop.py
  2. 21
      easy_my_coop_website/controllers/main.py

4
easy_my_coop/models/coop.py

@ -16,13 +16,11 @@ _REQUIRED = [
"firstname",
"lastname",
"birthdate",
"street_name",
"house_number",
"address",
"share_product_id",
"ordered_parts",
"zip_code",
"city",
"iban",
"gender",
]

21
easy_my_coop_website/controllers/main.py

@ -10,7 +10,7 @@ from odoo.tools.translate import _
_TECHNICAL = ["view_from", "view_callback"]
# transient fields used to compute the address field
_EXTRA_FIELDS = ["street_name", "house_number"]
_EXTRA_FIELDS = []
# Allow in description
_BLACKLIST = [
@ -31,8 +31,7 @@ _COOP_FORM_FIELD = [
"birthdate",
"iban",
"share_product_id",
"street_name",
"house_number",
"address",
"city",
"zip_code",
"country_id",
@ -55,8 +54,7 @@ _COMPANY_FORM_FIELD = [
"birthdate",
"iban",
"share_product_id",
"street_name",
"house_number",
"address",
"city",
"zip_code",
"country_id",
@ -301,7 +299,8 @@ class WebsiteSubscription(http.Controller):
if error:
values = self.fill_values(values, is_company, logged)
values["error_msg"] = _(
"Some mandatory fields have not " "been filled"
"Some mandatory fields have not "
"been filled (%s)" % error
)
values = dict(values, error=error, kwargs=kwargs.items())
return request.render(redirect, values)
@ -344,7 +343,8 @@ class WebsiteSubscription(http.Controller):
return request.render(redirect, values)
iban = kwargs.get("iban")
if iban.strip():
if iban:
iban.strip()
valid = sub_req_obj.check_iban(iban)
if not valid:
@ -469,13 +469,6 @@ class WebsiteSubscription(http.Controller):
values["share_product_id"] = self.get_selected_share(kwargs).id
values["address"] = "{street}, {number}".format(
street=kwargs.get("street_name", ""),
number=kwargs.get("house_number", ""),
)
del values["street_name"]
del values["house_number"]
if is_company:
if kwargs.get("company_register_number", is_company):
values["company_register_number"] = re.sub(

Loading…
Cancel
Save