Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
4244 Переглядів

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 Відповіді Переглядів Дія
6
жовт. 21
19272
1
груд. 19
2763
1
бер. 23
5739
2
груд. 19
15936
7
жовт. 19
10484