Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • xcg/odoo-modules/xbus_common
1 result
Show changes
Commits on Source (5)
/*
Xbus emitter for Odoo
Copyright (C) 2020 XCG Consulting <https://xcg-consulting.fr>
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/tools/debug_manager_backend.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 controller = this._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).
Base view ref: addons/web/static/src/xml/debug.xml. -->
<t t-extend="WebClient.DebugManager.View">
<t t-jquery="a[data-action='get_metadata']:parent" t-operation="after">
<a
role="menuitem"
href="#"
data-action="open_xbus_messages"
class="dropdown-item"
>
Xbus Messages
</a>
</t>
</t>
</templates>