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

Is there any widget options documentation?

Odoberať

Get notified when there's activity on this post

This question has been flagged
v8xmlreportsWidgets
4 Replies
40481 Zobrazenia
Avatar
Jeff Beidler

Looking at various template XML files, I sometimes see something like this:

t-field-options='{"widget": "contact", "fields": ["address"], "no_marker": true}'

However, I can't find any detailed documentation for various options that are available for such a statement.  There's lots of stuff on "widgets", but it's all about writing Python code to create your own thingamajig.  Is there any documentation for the XML formatting widgets?

0
Avatar
Zrušiť
Luke Branch

@Jeff, I'm also interested in this. I've purchased the theme developer handbook from Odoo's indiegogo campaign here: https://www.indiegogo.com/projects/bootstrap-themes-for-odoo-cms although the book is not likely to be released until the campaign finishes I believe it does cover the subject as it applies to the CMS/E-commerce and theme modules. Once I have read the book I will write back here with information on what I have learnt, however in the meantime if you find any resources covering widget creation and customisation I would be interested to know what you have found.

Avatar
Ray Carnes (ray)
Best Answer

Find the definition of these Widgets in the XML file defining the Templates:

https://github.com/odoo/odoo/blob/11.0/odoo/addons/base/ir/ir_qweb.xml

<odoo>
<template id="contact_name">
    <div t-if="'name' in fields">
        <t t-if="object.name">
            <span itemprop="name" t-esc="name"/>
        </t>
        <t t-if="not object.name and object.parent_name">
            <span itemprop="name" t-esc="object.parent_name"/>
        </t>
        <t t-if="options.get('country_image') and 'country_id' in fields and object.country_id and object.country_id.image">
            <span t-field="object.country_id.image" t-options='{"widget": "image", "class": "country_flag"}'/>
        </t>
    </div>
</template>
<template id="contact">
    <address t-ignore="true" class="mb0" itemscope="itemscope" itemtype="http://schema.org/Organization">
        <div t-if="not (('name' in fields) or (address and 'address' in fields) or (city and 'city' in fields) or (mobile and 'mobile' in fields) or (website and 'website' in fields) or (email and 'email' in fields))" class="css_non_editable_mode_hidden">
            --<span class="text-muted" t-esc="name"/>--
        </div>
        <t t-if="object.country_id.name_position != 'after'">
            <t t-call="base.contact_name"/>
        </t>
        <div itemprop="address" itemscope="itemscope" itemtype="http://schema.org/PostalAddress">
            <div t-if="address and 'address' in fields">
                <i t-if="not options.get('no_marker')" class='fa fa-map-marker fa-fw'/> <span itemprop="streetAddress" t-raw="address.replace('\n', options.get('no_tag_br') and ', ' or ('&lt;br/&gt;%s' % ('' if options.get('no_marker') else '&amp;nbsp; &amp;nbsp; ')))"/>
            </div>
            <div t-if="city and 'city' in fields">
                <i t-if="not options.get('no_marker')" class='fa fa-map-marker fa-fw'/>
                <span itemprop="addressLocality" t-raw="city"/>,
                <span itemprop="addressCountry" t-raw="country_id"/>
            </div>
            <div t-if="phone and 'phone' in fields"><i t-if="not options.get('no_marker') or options.get('phone_icons')" class='fa fa-phone fa-fw'/> <span itemprop="telephone" t-esc="phone"/></div>
            <div t-if="mobile and 'mobile' in fields"><i t-if="not options.get('no_marker') or options.get('phone_icons')" class='fa fa-mobile fa-fw'/> <span itemprop="telephone" t-esc="mobile"/></div>
            <div t-if="fax and 'fax' in fields"><i t-if="not options.get('no_marker') or options.get('phone_icons')" class='fa fa-fax fa-fw'/> <span itemprop="faxNumber" t-esc="fax"/></div>
            <div t-if="website and 'website' in fields">
                <i t-if="not options.get('no_marker')" class='fa fa-globe'/>
                <a t-att-href="website and '%s%s' % ('http://' if '://' not in website else '',website)"><span itemprop="website" t-esc="website"/></a>
            </div>
            <div t-if="email and 'email' in fields"><i t-if="not options.get('no_marker')" class='fa fa-envelope fa-fw'/> <span itemprop="email" t-esc="email"/></div>
        </div>
        <t t-if="object.country_id and object.country_id.name_position == 'after'">
            <t t-call="base.contact_name"/>
        </t>
    </address>
</template>
</odoo>
1
Avatar
Zrušiť
youring

for v12.0 https://github.com/odoo/odoo/blob/12.0/odoo/addons/base/views/ir_qweb_widget_templates.xml

Avatar
Justin
Best Answer

There's some basic Widgets documentation here: https://www.odoo.com/documentation/8.0/howtos/web.html#widgets-basics but that doesn't really cover the 'options' for widgets.

 One tip that I found that I'll leave here in case someone else comes looking (as I did): you can pass 'options' to the widget from the XML <field/> definition by setting an 'options' attribute to a JSON dictionary, like this:

<field name="myfield" widget='many2many_checkboxes' options='{"horizontal": 1}' />

This will set widget.options.horizontal to 1, and this option is then available within the QWeb template for the widget, so you can use options to alter the templated layout, for example.


2
Avatar
Zrušiť
Avatar
MageBinary
Best Answer

You can pass in the option inside t-field-options param as below


<div t-field="quotation.partner_invoice_id" t-field-options='{

"widget": "contact",

"fields": ["address", "name", "phone", "email"],

"no_marker": true

}'/>

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
Fields from QWeb Report Shifted/Move upon updating from another version
xml qweb reports
Avatar
0
jan 25
2050
Why won't the header appear in a PDF report? Solved
v8 reports wkhtmltopdf
Avatar
Avatar
Avatar
Avatar
Avatar
5
máj 23
20597
How to hide reports from print menu in odoo 14 ? Solved
xml reports v14
Avatar
Avatar
2
jan 23
12779
[SOLVED] how to add record number in reports ? Solved
v8 qweb reports
Avatar
Avatar
2
okt 22
7211
Two different reports for different companies
xml reports multicompany
Avatar
0
máj 21
2532
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