0 编辑 关闭 删除 标记 Change required field in Checkout form in ecommerce 编辑 关闭 删除 标记 odoo 8 十二月 2020 退订 订阅 评论 分享 4 注释 贴子评论 丢弃 odoo - 8 十二月 2020 删除 转换为答案 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. odoo - 8 十二月 2020 删除 转换为答案 Even phone is not in the array it is mandatory. Why? odoo - 8 十二月 2020 删除 转换为答案 Hello Cetin,It appears that the fields aren't being returned on that line of code it is the line before.# Required fields from formrequired_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? odoo - 9 十二月 2020 删除 转换为答案 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.<input type="hidden" name="field_required" t-att-value="'zip,name'"/>Thanks again. Have a good day.Cetin 1 答案 0 odoo 8 十二月 2020 最佳答案 Those sneaky Odoo people!There is a input field lower down in the QWeb form.<input type="hidden" name="field_required" t-att-value="'phone,name'"/>I assume if you remove phone from this you should be all good!Thanks, 备注 分享 1 备注 贴子评论 丢弃 odoo - 9 十二月 2020 删除 转换为答案 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.<input type="hidden" name="field_required" t-att-value="'zip,name'"/>Thanks again. Have a good day.Cetin1 Réponse
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.