Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Is there any widget options documentation?

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
v8xmlreportsWidgets
4 Respuestas
40482 Vistas
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
Descartar
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)
Mejor respuesta

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
Descartar
youring

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

Avatar
Justin
Mejor respuesta

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
Descartar
Avatar
MageBinary
Mejor respuesta

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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Fields from QWeb Report Shifted/Move upon updating from another version
xml qweb reports
Avatar
0
ene 25
2050
Why won't the header appear in a PDF report? Resuelto
v8 reports wkhtmltopdf
Avatar
Avatar
Avatar
Avatar
Avatar
5
may 23
20598
How to hide reports from print menu in odoo 14 ? Resuelto
xml reports v14
Avatar
Avatar
2
ene 23
12779
[SOLVED] how to add record number in reports ? Resuelto
v8 qweb reports
Avatar
Avatar
2
oct 22
7211
Two different reports for different companies
xml reports multicompany
Avatar
0
may 21
2532
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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