跳至内容
菜单
此问题已终结
1 回复
4140 查看

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"

形象
丢弃
相关帖文 回复 查看 活动
6
10月 21
19109
1
12月 19
2682
1
3月 23
5664
2
12月 19
15770
7
10月 19
10374