Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2292 Представления

I am trying to get sale order data on ecommerce, I found that there is something like this odoo addon

order = request.website.sale_get_order()

I debugged and found this is the function I am looking for, but I do not know how to use it in javascript

I tried

_onClick: function () {
return this._rpc({
model: 'website',
method: 'sale_get_order',
args: [""]
})
.then(function (result) {
console.log(result)
});
}
ValueError: Expected singleton: website()



Аватар
Отменить
Автор Лучший ответ

For anyone in the future who want to do something like this, I have found a solution

_onClick: function () {
return this._rpc({
route: "/shop/test/get_sale_order",
})
.then((orderInfo) => {
console.log(orderInfo)

In python controller

@http.route('/shop/test/get_sale_order', type='json', auth="public", website=True)
def sale_order_info(self):
print("sale_order_info")
order = request.website.sale_get_order()
print("sale_order ===>>>>", order)

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
сент. 25
1960
1
июн. 25
1986
3
июл. 25
3575
1
мая 25
1697
4
мая 25
3044