Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3349 Lượt xem

What change in the HTML code should be made to make 'State' address field mandatory?


Background:

Shipping method requires the state to be set.

However ecommerce customers often skip this as it is not a required field.

Hence incorrect shipping method is assigned.

Odoo 13 Standard Model does not make the State field mandatory. The only way I can see to change this is to edit the HTML code.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

The form view is defined in website_sale.address and my v13 community and enterprise testing shows that the checkout flow cannot proceed without the State being selected. The form view does this with an error coded into the view. See my v13 snippet here.




Also note that the mandatory field requirements are handled in an additional layer via the following function in the v13 code in main.py:

def _get_mandatory_shipping_fields(self):

        return ["name", "street", "city", "country_id"]

Updating this code requires development and cannot be done via the front-end.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 24
5879
4
thg 5 25
2964
2
thg 7 24
2858
4
thg 8 25
10938
1
thg 9 24
1413