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

Description:

Hello Odoo community,

I'm currently configuring the checkout process for my Odoo e-commerce site and need some guidance. Currently, the checkout process requires customers to enter their email address as a mandatory field. However, I would like to make the phone number field mandatory instead, and make the email address field optional.

Current Setup:

  • Email address is currently set as a mandatory field during checkout.

Desired Setup:

  • Make the phone number field mandatory.
  • Make the email address field optional.

Environment:

  • Odoo version: [17 Online with Studio ]

I have reviewed the configuration settings but haven't found an obvious way to switch these requirements. Any guidance or steps on how to achieve this customization would be greatly appreciated!

Thank you in advance for your help.


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

Hello Gem Aquarist,


from Odoo.addons.website_sale.controllers.main import WebsiteSale


//Code in Comment//


Hope this Helps,

If you need any help in customization feel free to contact us.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Ảnh đại diện
Huỷ bỏ

Code:

class WebsiteSale(payment_portal.PaymentPortal):

def _get_mandatory_fields_shipping(self, country_id=False):
res = super()._get_mandatory_fields_shipping(country_id)
if res['email']:
res.remove('email')
if 'phone' not in res:
res.append('phone')
return res

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 25
1109
1
thg 2 25
6196
4
thg 1 25
2491
2
thg 10 24
1531
0
thg 6 24
1307