Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
13884 Widoki

It's possible to use sudo on rpc query like that?
Or for doing that i need to call a backend method with rpc.call?

var unit_amount = $("input[name='unit_amount']");
//Take the id of the selected product
var product_id_int = Number(product.val());
var args = [["product_id", "=", product_id_int]];
//Search and hr.expense with this product_id
rpc.query({
model: "hr.expense",
method: "search",
args: [args],
}).then(function (result_expense) {
Awatar
Odrzuć
Najlepsza odpowiedź

Try RPC calls from session object.

var session = require('web.session');
...
return session.rpc('/web/dataset/call_button', {
model: this.name,
method: method,
// Should not be necessary anymore. Integrate remote in this?
domain_id: null,
context_id: args.length - 1,
args: args || []
});

Check this example


Awatar
Odrzuć
Autor Najlepsza odpowiedź

Yes finally i used something like session.
Which are the differences with your code that use session.rpc....and mine?

rpc.query({
model: "project.task",
method: "save_stage_id",
args: [false, task_id_int, dataToSend],
}).then(function () {
//Set a delay or the update is not visible
window.location.reload();
});


Where can i find a good explanation of all rpc calls? I see that exists many types of them (for each odoo versions)
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lis 18
3395
0
kwi 18
2348
1
lip 19
6078
2
lip 24
1776
1
cze 24
4435