Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6259 มุมมอง

Hi,

    I am new in odoo and currently, I am developing a module that adds a field on the website. May I know how to add a selection field in website payment page.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You have to inherit the payment template of website payment page(website_sale.payment) for adding a new field to it.

You can refer the following example for adding a selection field in payment page of website

<template id="website_payment_inherit" inherit_id="website_sale.payment">
<xpath expr="//div[@id='payment_method']" position="before">
<t t-set="field_name_val"
t-value="request.env['model.name'].sudo().
search([])"/>
<select class='detail needsclick' name='field_name'>
<option value=''>None</option>
<t t-foreach='field_name_val' t-as='val'>
<option t-att-value='val.id'>
<t t-esc='val.name'/>
</option>
</t>
</select>
</xpath>
</template>

To know more about Odoo website-controllers visit the following blog

https://www.cybrosys.com/blog/web-controllers-in-odoo

If you new to Odoo development then you can refer the below resources for the future development purpose

https://www.youtube.com/playlist?list=PLeJtXzTubzj-tbQ94heWeQFB0twGd0vvN

Regards

อวตาร
ละทิ้ง
ผู้เขียน

Thank you

คำตอบที่ดีที่สุด

@aghezzaf mohamed did you know how to do that ?

อวตาร
ละทิ้ง