Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Display Database name wthout activate debug mode odoo12

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
stylesheetjavascripserpentNiyasYenthe
1 Répondre
4627 Vues
Avatar
Osman Alrasheed Serelkhatim

 I do change for UserMenu.js script to display Database name in cosole my assets file loaded whiteout error but it have no effect on interface , in the flowing my assets file and custom scrip :

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- create an inherited view of the assets bundle, and add the js file to display Datebase name with For example,-->
<template id="assets_backend" name="database_name assets" inherit_id="web.assets_backend">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/backend_customization_12/static/src/js/chrome/database.js"></script>
</xpath>
</template>
</odoo>

javascript module

odoo.define('backend_customization_12.NewHomeMenu', function (require) {
"use strict";

/**
this Js script to inherit HomeMenu widget to Modifying to dispay database name
*/

var UserMenu = require('web.UserMenu');
var Widget = require('web.Widget');

var NewHomeMenu. = UserMenu.extend({
template: 'NewHomeMenu',


start: function () {
var self = this;
var session = this.getSession();
this.$el.on('click', '[data-menu]', function (ev) {
ev.preventDefault();
var menu = $(this).data('menu');
self['_onMenu' + menu.charAt(0).toUpperCase() + menu.slice(1)]();
});
return this._super.apply(this, arguments).then(function () {
var $avatar = self.$('.oe_topbar_avatar');
if (!session.uid) {
$avatar.attr('src', $avatar.data('default-src'));
return $.when();
}
var topbar_name = session.name;
// if (session.debug) {
// topbar_name = _.str.sprintf("%s (%s)", topbar_name, session.db);
// }
topbar_name = _.str.sprintf("%s (%s)", topbar_name, session.db);
self.$('.oe_topbar_name').text(topbar_name);
var avatar_src = session.url('/web/image', {
model:'res.users',
field: 'image_small',
id: session.uid,
});
$avatar.attr('src', avatar_src);
});
},

var dog = new NewHomeMenu();


return dog.start();

});






0
Avatar
Ignorer
Avatar
Ravi Gadhia
Meilleure réponse

I think you need to use UserMenu.include instead of UserMenu.extend and do not define a new template ('NewHomeMenu') for it 

Here you create a new instance of NewHomeMenu but you don't append it to DOM so it's not working and start method will automatically call when widget added to dom you don't have to call it explicitly but in this case, just used include instead of extend and it will work fine.

​

0
Avatar
Ignorer
Osman Alrasheed Serelkhatim
Auteur

thank for respond , exactly I want move out (topbar_name = _.str.sprintf("%s (%s)", topbar_name, session.db);) line out of if condition how I can do this in my custom scrip after using include instead of extend is the only this I need to do is cope all the default code whit change that line @Ravi Gadhia

Ravi Gadhia

the correct way is inherit UserMenu using include and override the start method,

in start method call the super using this._super.apply(this, arguments) after that re assigns the value of topbar using

var topbar_name = _.str.sprintf("%s (%s)", topbar_name, session.db);

self.$('.oe_topbar_name').text(topbar_name);

but there will be no error if you override the whole method without calling super

Osman Alrasheed Serelkhatim
Auteur

I appreciate your support , still has no result and this is latest code

odoo.define('backend_customization_12.NewHomeMenu', function (require) {

"use strict";

/**

this Js script to inherit HomeMenu widget to Modifying to dispay database name

*/

var NewUserMenu = require('web.UserMenu');

var Widget = require('web.Widget');

NewUserMenu.include({({

template: 'NewHomeMenu',

start: function () {

this._super.apply(this, arguments)

var topbar_name = _.str.sprintf("%s (%s)", topbar_name, session.db);

self.$('.oe_topbar_name').text(topbar_name);

},

return NewUserMenu;

});

Ravi Gadhia

odoo.define('backend_customization_12.NewHomeMenu', function (require) {

"use strict";

/**

this Js script to inherit HomeMenu widget to Modifying to dispay database name

*/

var NewUserMenu = require('web.UserMenu');

NewUserMenu.include({

start: function () {

var self = this;

var def = this._super.apply(this, arguments);

def.then(function () {

var session = self.getSession();

var topbar_name = _.str.sprintf("%s (%s)", session.name, session.db);

self.$('.oe_topbar_name').text(topbar_name);

});

return def;

},

});

});

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Make Helpdesk route auth=''user', in odoo 13
Niyas Yenthe
Avatar
0
oct. 20
3982
odoo chatter doesn't appear in scrap form !!!!??? Résolu
Niyas Yenthe
Avatar
Avatar
4
oct. 19
4811
default_order doesn't work for me in tree view Résolu
Niyas Yenthe Sudhir
Avatar
Avatar
Avatar
2
févr. 22
9497
How can i programmatically reconcile 2 account.move
Niyas Yenthe ray
Avatar
0
août 20
4887
how to set if condiction for dictionry value in qweb
Niyas Yenthe Ravi
Avatar
Avatar
Avatar
2
janv. 20
4685
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now