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

hello guys, i want to ask about the controller in odoo, i have a task to create API from odoo to send a list of data to the backend team, and im aware i need to use odoo controller, but still not familiar with it.. 

so the task is, the backend team with this specification:
endpoint = /warehouse/{warehouse_id}/routing

and this is my code:
@http.route(['/warehouse/<int:warehouse_id>/routing'], type='http', auth="public", website=True)

def get_sale_data(self, warehouse_id):
    sale = request.env['sale.order'].search([('company_id', '=', warehouse_id)])

    result = set()

    for sl in sale:
        result = result.add(sl.id)

    return result


is my code right? and what is the difference between type = 'http' or 'json' can you give me an example? thanks about it

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

Type="json" website="False"

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Redirect to tree view with Controller แก้ไขแล้ว
6
ต.ค. 21
19302
Odoo 11 Cash Rounding via External API. แก้ไขแล้ว
1
ธ.ค. 19
2773
1
มี.ค. 23
5762
2
ธ.ค. 19
15968
7
ต.ค. 19
10493