콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
4247 화면

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

아바타
취소
관련 게시물 답글 화면 활동
1
3월 22
2044
0
7월 22
2941
1
6월 22
6320
1
6월 25
1618
3
7월 25
3263