Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Extending/Overriding public widgets.

Odebírat

Get notified when there's activity on this post

This question has been flagged
widgetjs
1 Odpovědět
8397 Zobrazení
Avatar
Daniel Löfgren

I am working on odoo 14. I have the following public widget defined in the core/addons/website_sale module that I need to extend/override.

My goal for this question is, how do I define a call from another module, too this widget, that lets me access the widget, and overwrite for example xmlDependencies: field, and the start: function () method.

I am unsure of how I should approch accessing this widget externally, since it has no return, if it is at all possible.

odoo.define('website_sale.s_products_searchbar', function (require) {

'use strict';

const concurrency = require('web.concurrency');

const publicWidget = require('web.public.widget');

const { qweb } = require('web.core');

publicWidget.registry.productsSearchBar = publicWidget.Widget.extend({ 

selector: '.o_wsale_products_searchbar_form', 

xmlDependencies: ['/website_sale/static/src/xml/website_sale_utils.xml'], 

events: { 

    'input .search-query': '_onInput', 

    'focusout': '_onFocusOut', 

    'keydown .search-query': '_onKeydown', 

    }, 

    autocompleteMinWidth: 300,

    /** 

    * @constructor 

    */ 

    init: function () { 

        this._super.apply(this, arguments);
        this._dp = new concurrency.DropPrevious();
        this._onInput = _.debounce(this._onInput, 400); 

        this._onFocusOut = _.debounce(this._onFocusOut, 100); 

    }, 

    /** 

    * @override 

    */ 

    start: function () { 

        this.$input = this.$('.search-query');
        this.order = this.$('.o_wsale_search_order_by').val(); 

        this.limit = parseInt(this.$input.data('limit')); 

        this.displayDescription = !!this.$input.data('displayDescription'); 

        this.displayPrice = !!this.$input.data('displayPrice'); 

        this.displayImage = !!this.$input.data('displayImage');
        if (this.limit) { 

                this.$input.attr('autocomplete', 'off'); 

        }
    return this._super.apply(this, arguments); 

    },
    /* ..... REST OF FILE .....*/

});
});


0
Avatar
Zrušit
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Nejlepší odpověď

Hi,

You can access it by

const publicWidget = require('web.public.widget');

//extending
publicWidget.registry.productsSearchBarNew = publicWidget.registry.productsSearchBar.extend({})

//including
publicWidget.registry.productsSearchBar.include({})

Regards

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Override Many2ManyListView under web.form_relational !! Vyřešeno
widget js
Avatar
Avatar
1
čvc 16
4866
problem with bind a js widget and xml Template to add it in html dev
widget templates js
Avatar
Avatar
1
čvn 23
3779
Sign App won't display PDF while custom JS widget added to the SystrayMenu
widget js sign
Avatar
0
led 21
3475
Error: "Could not find client action MyWidget" in widget [Odoo 12.0alpha1+e]
widget js master
Avatar
Avatar
Avatar
2
pro 19
9250
How to Inheirt SectionAndNoteListRenderer function to include my custom code Vyřešeno
widget js render
Avatar
Avatar
1
pro 19
6435
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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