跳至內容
選單
此問題已被標幟
1 回覆
2320 瀏覽次數

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)

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
9月 25
2015
1
6月 25
2038
3
7月 25
3622
1
5月 25
1750
4
5月 25
3075