odoo.define('web.SwitchCompanyMenu', function(require) { "use strict"; /** * When Odoo is configured in multi-company mode, users should obviously be able * to switch their interface from one company to the other. This is the purpose * of this widget, by displaying a dropdown menu in the systray. */ var config = require('web.config'); var core = require('web.core'); var session = require('web.session'); var SystrayMenu = require('web.SystrayMenu'); var Widget = require('web.Widget'); var _t = core._t; var SwitchCompanyMenu = Widget.extend({ template: 'SwitchCompanyMenu', events: { 'click .dropdown-menu li a[data-menu]': '_onClick', }, /** * @override */ init: function () { this._super.apply(this, arguments); this.isMobile = config.device.isMobile; this._onClick = _.debounce(this._onClick, 1500, true); }, /** * @override */ willStart: function () { return session.user_companies ? this._super() : $.Deferred().reject(); }, /** * @override */ start: function () { var companiesList = ''; if (this.isMobile) { companiesList = '