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

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?


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

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.

Аватар
Отменить
Автор

it works, thak you

Автор Лучший ответ

it works, thak you

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
мар. 22
2046
0
июл. 22
2958
1
июн. 22
6326
1
июн. 25
1647
3
июл. 25
3282