website_membership_signup_required: phone not required
This commit is contained in:
parent
c4d32c6add
commit
54965d483f
2 changed files with 92 additions and 3 deletions
|
|
@ -95,4 +95,31 @@ class WebsiteSaleMembershipSignup(WebsiteSale):
|
|||
product_custom_attribute_values=product_custom_attribute_values,
|
||||
no_variant_attribute_value_ids=no_variant_attribute_value_ids,
|
||||
**kwargs
|
||||
)
|
||||
)
|
||||
|
||||
def _get_mandatory_address_fields(self, country_sudo):
|
||||
# EMES: the phone field is not mandatory at checkout, for any flow
|
||||
# (membership or regular). The core's default set in
|
||||
# `website_sale/controllers/main.py:_get_mandatory_address_fields`
|
||||
# includes 'phone' alongside name/street/city/country_id. Removing it
|
||||
# here cascades to both billing and delivery mandatory fields (both
|
||||
# delegates to this method) and propagates to the frontend: the
|
||||
# hidden `required_fields` input sent to the address form no longer
|
||||
# lists 'phone', so `address.js` neither marks the input as
|
||||
# `:required` nor shows the red asterisk, and the server-side
|
||||
# `_check_billing_address` / `_check_delivery_address` no longer
|
||||
# reject empty phones.
|
||||
fields = super()._get_mandatory_address_fields(country_sudo)
|
||||
fields.discard("phone")
|
||||
return fields
|
||||
|
||||
def _get_mandatory_fields(self):
|
||||
# Portal's `_get_mandatory_fields` (in
|
||||
# `portal/controllers/portal.py`) returns
|
||||
# `["name", "phone", "email", "street", "city", "country_id"]`,
|
||||
# and `website_sale`'s `_get_mandatory_billing_address_fields`
|
||||
# UNIONS that set with the one from `_get_mandatory_address_fields`.
|
||||
# So even after we drop 'phone' from the address set above, the
|
||||
# portal set re-adds it for billing. We need to drop it here too.
|
||||
fields = list(super()._get_mandatory_fields())
|
||||
return [f for f in fields if f != "phone"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue