Skip to Content
Menu
This question has been flagged
1 Reply
1671 Views

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
2
May 22
11923
2
Apr 22
2787
1
Apr 22
2012
9
Jun 24
26773
1
Nov 23
8222