Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
4201 Weergaven

http://localhost:8070/web#menu_id=525&action=694


i want to get action id (as number/integer) from external id ('model.action_id') using javascript, any idea?


Avatar
Annuleer
Beste antwoord

You can use the rpc method in JavaScript to call the search method on the ir.actions.act_window model to get the action ID using the external ID. Here is an example code snippet that you can use:

javascript

var external_id = 'model.action_id';
var model = 'ir.actions.act_window';
rpc.query({
model: model,
method: 'search',
args: [['xml_id', '=', external_id]],
context: session.user_context,
}).then(function(ids) {
if (ids.length > 0) {
var action_id = ids[0];
console.log('Action ID: ' + action_id);
}
});

This code will search for the ir.actions.act_window record with the specified xml_id (which is the external ID) and return the ID of the first record found. You can then use the action_id variable to perform other operations with the action, such as opening it.

Avatar
Annuleer
Auteur

it works, thak you

Auteur Beste antwoord

it works, thak you

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
mrt. 22
2017
0
jul. 22
2882
1
jun. 22
6281
1
jun. 25
1470
3
jul. 25
3171