Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2805 Vistas

I am very bad at JS. I want to add a systray menu next to 'switch company'. I have managed to get the information from a python file, but I would like it to have the same functionality as 'switch company'. In other words, when I click on one of the submenus of my 'Fiscal Period' they replace the original. This is for odoo 15. I need your help plss

JS code:

/** @odoo-module **/
import { registry } from"@web/core/registry";
const { Component, hooks } = owl;
const { useState } = hooks;constrpc = require('web.rpc');
export classFiscalPeriod extends Component { 

    async willStart() {
    varself = this;
    this.ejemplo = 1;
    this.data = rpc.query({
        model:'account.fiscal.year',
        method:'get_not_accepted',
        args: [''],
        }).then(function(res){
            console.log(res);
            console.log("entré aquí 4");
            self.data = res
        })}
FiscalPeriod.template = "account_accountan.fiscal_period";
export const systrayItem = {
    Component:FiscalPeriod,
};registry.category("systray").add("FiscalPeriod", systrayItem, { sequence:1000 });
Avatar
Descartar
Mejor respuesta

Hi,

You can try the following code to add the Systray Icon.

odoo.define('reminder.reminder_topbar', function (require) {
"use strict";

var core = require('web.core');
var SystrayMenu = require('web.SystrayMenu');
var Widget = require('web.Widget');
var QWeb = core.qweb;
var rpc = require('web.rpc');
var ajax = require('web.ajax');var reminder_menu = Widget.extend({
    template:'reminder_menu',});

SystrayMenu.Items.push(reminder_menu);
});

<templates>     <t t-name="reminder_menu"         <div class="o_mail_navbar_item"             <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="#" title="Reminders"                <i class="fa fa-bell"/>                 <span class="o_notification_counter"/>             </a></div></t></templates>


Regards

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
may 22
14169
2
abr 22
4298
1
abr 22
3390
1
jul 25
3678
10
dic 24
31315