Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4016 มุมมอง

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
1834
0
ก.ค. 22
2684
1
มิ.ย. 22
6098
1
มิ.ย. 25
1014
3
ก.ค. 25
2744