Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
2312 Visualizzazioni

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()



Avatar
Abbandona
Autore Risposta migliore

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)

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
set 25
2009
1
giu 25
2030
3
lug 25
3616
1
mag 25
1744
4
mag 25
3072