Hello together,
how it is possible to change the required fields in checkout form in ecommerce. For example in the standard the phone number is a required field but ZIP code not. I want set phone as not required and ZIP code as required field in the checkout form.
Thanks in advanced
cakbulut
I am using odoo 13.
In the class /odoo/odoo-server/addons/website_sale/controllers/main.py I have found following lines:
def _get_mandatory_billing_fields(self): return ["name", "email", "street", "city", "country_id"]
def _get_mandatory_shipping_fields(self): return ["name", "street", "city", "country_id"]
What I do not understand is that phone is not in the mandatory list.
Even phone is not in the array it is mandatory. Why?
Hello Cetin,
It appears that the fields aren't being returned on that line of code it is the line before.
# Required fields from form
required_fields = [f for f in (all_form_values.get('field_required') or '').split(',') iff]
raise Warning(required_fields)
I raised a warning to see what is going on and this is what is returned:
Warning: ['phone', 'name']
It appears they are being sent as "required fields" as they come straight from the KW variable?
Hi Jack,
million thanks for your advise. I have not seen the line in the QWeb. Now I changed the line as follows, so that zip is required, but phone not.