Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
33
web_systray_button_init_action/static/src/button/button.esm.js
Executable file
33
web_systray_button_init_action/static/src/button/button.esm.js
Executable file
@@ -0,0 +1,33 @@
|
||||
/* @odoo-module */
|
||||
/* Copyright 2024 Tecnativa - David Vidal
|
||||
* Copyright 2024 Tecnativa - Carlos Roca
|
||||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||
import {Component} from "@odoo/owl";
|
||||
import {registry} from "@web/core/registry";
|
||||
import {useService} from "@web/core/utils/hooks";
|
||||
import {user} from "@web/core/user";
|
||||
|
||||
export class InitActionMenu extends Component {
|
||||
setup() {
|
||||
this.action = useService("action");
|
||||
this.showHomeButton = Boolean(user.homeActionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to user init action when clicking it
|
||||
* @private
|
||||
*/
|
||||
onClickInitAction() {
|
||||
window.location.href = window.location.origin + "/odoo";
|
||||
}
|
||||
}
|
||||
|
||||
InitActionMenu.template = "web_systray_button_init_action.Button";
|
||||
|
||||
export const systrayInitAction = {
|
||||
Component: InitActionMenu,
|
||||
};
|
||||
|
||||
registry
|
||||
.category("systray")
|
||||
.add("web_systray_button_init_action.button", systrayInitAction, {sequence: 100});
|
||||
11
web_systray_button_init_action/static/src/button/button.scss
Executable file
11
web_systray_button_init_action/static/src/button/button.scss
Executable file
@@ -0,0 +1,11 @@
|
||||
.init_action_div {
|
||||
button {
|
||||
height: 100%;
|
||||
color: white;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(0, 0, 0, 0.075);
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
web_systray_button_init_action/static/src/button/button.xml
Executable file
16
web_systray_button_init_action/static/src/button/button.xml
Executable file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates>
|
||||
<t t-name="web_systray_button_init_action.Button">
|
||||
<div class="init_action_div" t-if="showHomeButton">
|
||||
<button
|
||||
name="init_action"
|
||||
class="btn btn-link"
|
||||
title="Init Action"
|
||||
href="#"
|
||||
t-on-click="onClickInitAction"
|
||||
>
|
||||
<i class="fa fa-lg fa-home" role="img" aria-label="Init Action" />
|
||||
</button>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
36
web_systray_button_init_action/static/src/tours/tour.esm.js
Executable file
36
web_systray_button_init_action/static/src/tours/tour.esm.js
Executable file
@@ -0,0 +1,36 @@
|
||||
/* Copyright 2024 Tecnativa - Carlos Roca
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
|
||||
|
||||
import {registry} from "@web/core/registry";
|
||||
import {stepUtils} from "@web_tour/tour_service/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add("web_systray_button_init_action_not_set_tour", {
|
||||
url: "/web",
|
||||
test: true,
|
||||
steps: () => [
|
||||
{
|
||||
trigger: ":not(:has(button[name='init_action']))",
|
||||
},
|
||||
],
|
||||
});
|
||||
registry.category("web_tour.tours").add("web_systray_button_init_action_set_tour", {
|
||||
url: "/web",
|
||||
test: true,
|
||||
steps: () => [
|
||||
{
|
||||
trigger: ".init_action_div:has(button[name='init_action'])",
|
||||
},
|
||||
stepUtils.showAppsMenuItem(),
|
||||
{
|
||||
trigger: ".o_app[data-menu-xmlid='base.menu_administration']",
|
||||
run: "click",
|
||||
},
|
||||
{
|
||||
trigger: "button[name='init_action']",
|
||||
run: "click",
|
||||
},
|
||||
{
|
||||
trigger: ".o_last_breadcrumb_item:has(span:contains('Apps'))",
|
||||
},
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user