Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Overriding odoo javascript function (start.js file in web addon)

Odoberať

Get notified when there's activity on this post

This question has been flagged
webclientwebwebmodule
2269 Zobrazenia
Avatar
Hakim Chamakhi

Hello,

I am working on a custom addon in Odoo and I need to override a specific line in a core JavaScript file. The file I am referring to is located in the Odoo web client (start.js file) and contains the following code:

/** @odoo-module **/


import { makeEnv, startServices } from "./env";

import { legacySetupProm } from "./legacy/legacy_setup";

import { mapLegacyEnvToWowlEnv } from "./legacy/utils";

import { processTemplates } from "./core/assets";

import { session } from "@web/session";


const { mount, utils } = owl;

const { whenReady } = utils;


/**

* Function to start a webclient.

* It is used both in community and enterprise in main.js.

* It's meant to be webclient flexible so we can have a subclass of

* webclient in enterprise with added features.

*

* @param {owl.Component} Webclient

*/

export async function startWebClient(Webclient) {

    odoo.info = {

        db: session.db,

        server_version: session.db_version,

        server_version_info: session.server_version_info,

        isEnterprise: session.server_version_info.slice(-1)[0] === "e",

    };

    odoo.isReady = false;


    // setup environment

    const env = makeEnv();

    const [, templates] = await Promise.all([

        startServices(env),

        odoo.loadTemplatesPromise.then(processTemplates),

    ]);

    env.qweb.addTemplates(templates);


    // start web client

    await whenReady();

    const legacyEnv = await legacySetupProm;

    mapLegacyEnvToWowlEnv(legacyEnv, env);

    const root = await mount(Webclient, { env, target: document.body, position: "self" });

    // delete odoo.debug; // FIXME: some legacy code rely on this

    odoo.__WOWL_DEBUG__ = { root };

    odoo.isReady = true;


    // Update Favicons

    const favicon = `/web/image/res.company/${env.services.company.currentCompany.id}/favicon`;

    const icons = document.querySelectorAll("link[rel*='icon']");

    const msIcon = document.querySelector("meta[name='msapplication-TileImage']");

    for (const icon of icons) {

        icon.href = favicon;

    }

    if (msIcon) {

        msIcon.content = favicon;

    }

}


Specifically, I want to change the following line in my custom addon:
const favicon = `/web/image/res.company/${env.services.company.currentCompany.id}/favicon`;

to : 
const favicon = (static path to a favicon.ico)


I understand that directly modifying core files is not recommended, so I am looking for a way to achieve this through a custom addon. Could someone guide me on how to properly override or extend this specific line in my custom addon?

Thank you in advance for your help!

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Erase button "Add to basket"
webclient web
Avatar
Avatar
2
feb 24
2072
Reg: Odoo 12.0 installation in Ubuntu 14.04 - Module Images are not loading
webclient web
Avatar
Avatar
1
máj 19
5211
Could not find client action Solved
web webmodule
Avatar
Avatar
Avatar
Avatar
3
mar 15
21503
Can we hide th Export in "more" options
webclient web odoo
Avatar
0
aug 24
4611
Odoo shows blank page on /web but /website stil works Solved
webclient web multiwebsite
Avatar
Avatar
Avatar
2
máj 23
8083
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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