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

i want to add new button on the web page and perfome action on the button in odoo 9

anybody plz help me

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

First you need to define the button inside a <form> tag in the website template XML, e.g.


<form action="/my_new_controller" method="post">
<!-- put other forms field here if you need to pass info to controller -->
<button type="submit" class="btn">Call a controller</button>
</form>

Clicking the  button submits the form and calls the controller at www.myodoosite.com/my_new_controller. You can define the controller in python with something like this:

class website_account(http.Controller):

  @http.route(['/my_new_controller'], type='http', auth='public', website=True)
def my_controller_method(self, redirect=None, **post):
# Put your backend operations here, e.g.
# sale_model = request.env['sale.order']
# sale_model.create({...})

# After you're done, use either request.render() or request.redirect() to show
# a different page to the user. You can check out the website_portal module for examples.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ธ.ค. 24
5556
3
ส.ค. 24
6394
how to know the odoo master password? แก้ไขแล้ว
4
ก.ค. 24
40523
1
ก.พ. 24
1751
Default value in form view แก้ไขแล้ว
5
เม.ย. 23
97299