I have created a client action which shows list view (Using owl template), now on click of each item i want to open another owl template so how can pass record id to fetch data in it?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi,
Define a method in your JavaScript file: odoo.define('your_module_name.your_js_file', function (require) {
"use strict";
var core = require('web.core');
var Widget = require('web.Widget');
var _t = core._t;
var YourWidget = Widget.extend({
template: 'YourTemplate',
events: {
'click .list-item': '_onListItemClick',
},
_onListItemClick: function (ev) {
var recordID = $(ev.currentTarget).data('record-id');
this.do_action({
name: _t("Open Record"),
type: 'ir.actions.act_window',
res_model: 'your.model.name',
res_id: recordID,
views: [[false, 'form']],
target: 'current',
});
},
});
return YourWidget;
});
Pass Record ID from the template:<t t-name="YourTemplate">
<div class="list-item" t-att-data-record-id="record.
<!-- Your list item content here -->
</div>
</t>
Hope it helps
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
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 | |
---|---|---|---|---|
|
0
thg 8 24
|
861 | ||
|
5
thg 3 25
|
3142 | ||
|
1
thg 2 25
|
1546 | ||
|
1
thg 12 24
|
4377 | ||
|
0
thg 11 24
|
1796 |