Skip to content
Snippets Groups Projects
Commit 64a5fabc authored by Houzefa Abbasbhay's avatar Houzefa Abbasbhay :slight_smile:
Browse files

Debug menu: Add "Xbus messages" to open them

parents
No related branches found
No related tags found
No related merge requests found
/*
Xbus emitter for Odoo
Copyright (C) 2020 XCG Consulting <http://odoo.consulting>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Add an "Xbus messages" link to open related messages from the debug menu.
*
* Base Odoo code:
* - addons/web/static/src/js/widgets/debug_manager.js
*/
odoo.define('xbus_emitter.debug_manager_xbus', function(require) {
'use strict';
var DebugManager = require('web.DebugManager');
DebugManager.include({
/* Add an "Xbus messages" link to open related messages from the debug menu. */
open_xbus_messages: function() {
var view = this._active_view;
if (view === undefined) {
return;
}
var controller = view.controller;
if (controller === undefined) {
return;
}
var record_ids = controller.getSelectedIds();
if (record_ids === undefined || !record_ids.length) {
console.warn('No active records.');
return;
}
var record_id = record_ids[0];
var record_model = controller.modelName;
var self = this;
self._rpc({
domain: [['name', 'in', ['xbus_emitter_job_list', 'xbus_emitter_job_form']]],
fields: ['type'],
limit: 2,
method: 'search_read',
model: 'ir.ui.view',
}).then(function(views) {
self.do_action({
domain: [['record_id', '=', record_id], ['record_model', '=', record_model]],
name: 'Xbus messages',
res_model: 'xbus.emitter.job',
type: 'ir.actions.act_window',
views: [[_.findWhere(views, {
type: "tree"
}).id, 'list'], [_.findWhere(views, {
type: "form"
}).id, 'form']],
});
});
},
}); // DebugManager
});
<?xml version="1.0" encoding="utf-8"?>
<templates xml:space="preserve">
<!-- Add an "Xbus messages" link for single records
("Get metadata" only gets shown for single records). -->
<t t-extend="WebClient.DebugManager.View">
<t t-jquery="a[data-action='get_metadata']:parent" t-operation="after">
<li><a href="#" data-action="open_xbus_messages">Xbus Messages</a></li>
</t>
</t>
</templates>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment