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:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
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
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
0
أغسطس 24
|
866 | ||
|
5
مارس 25
|
3143 | ||
|
1
فبراير 25
|
1549 | ||
|
1
ديسمبر 24
|
4383 | ||
|
0
نوفمبر 24
|
1800 |