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?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 3 22
|
1565 | ||
|
0
thg 7 22
|
2450 | ||
|
1
thg 6 22
|
5694 | ||
|
1
thg 5 25
|
482 | ||
|
4
thg 5 25
|
1775 |