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
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Inteligencia artificial
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Sectores
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Asesoría contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Cervecería
    • Regalos corporativos
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Oficios
    • Servicios de mantenimiento
    • Hardware y soporte técnico
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de vallas publicitarias
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Explorar todos los sectores
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Servicios para partners
    • Registrar tu asesoría contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Sobre este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Sobre este foro
Ayuda

Available variables in email templates

Suscribirse

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

Esta pregunta ha sido marcada
qwebemailtemplatearray
1 Responder
781 Vistas
Avatar
Luc Bernard

I want to know which variables i have available in my email templates.

How can I display all keys and values of the object-array to see what's available?

Something like this?

<t t-foreach=“object[]”>

    <t t-out="object[key]”/>: <t t-out="object[value]”/><br/>

</t>

0
Avatar
Descartar
Codesphere Tech

Hello
Try this
<t t-foreach="object._fields" t-as="field_name">
<t t-if="object[field_name]">
<t t-esc="field_name"/>:
<t t-esc="object[field_name]"/><br/>
</t>
</t>

Luc Bernard
Autor

@Codesphere Tech When I add this I get this error:
Error: You do not have enough rights to access the field "milestone_count" on Project (project.project). Please contact your system administrator.

Codesphere Tech

Please verify that you are logged in as Administrator.

Luc Bernard
Autor

@Codesphere Yes I am. I'm even in Developer Mode. It works in most of them but not when 'Applies to: Project' and that's exactly where I need it.

Codesphere Tech

I will check for Email Template: Applies To: Project and let you know here.

Codesphere Tech

Some fields are restricted to specific user groups (for example, fields like milestone_count or duration_tracking in Projects). Even if you are logged in as Administrator or using Developer Mode, it does not guarantee access to those fields, because field-level security depends on group membership.
-> So I suggest that use specific known fields in the template or you can add admin to project group(not recommended).

Luc Bernard
Autor

@Codesphere

[-> So I suggest that use specific known fields in the template...]

That's exactly what I need this for, to see which variables are available.

[... or you can add admin to project group(not recommended)]

I am the creator/owner of the db so how can I get more rights than the ones I already have? Or is there a way to exclude these restricted variables from the query?

Codesphere Tech

Hello,
Being the database owner or Administrator doesn’t automatically give unrestricted access to every field in Odoo.
Some fields are protected by field-level security or internal logic, so they may still be restricted even for admin users.
If you need access, you can:
-> Add your user to the relevant functional group (in this case, Project-related groups), if appropriate
-> Check available fields via Settings → Technical → Database Structure → Fields and filter by the Project model
I’ll explore other solutions for this.

Avatar
Javier Garcia
Mejor respuesta

In Odoo email templates, object is not a dictionary; it's a recordset, so you can't iterate it with t-foreach="object[]". Here's what's actually available:

Standard variables in every email template:

  • object; the record the template is applied to (e.g. sale.order record)
  • user; the current user (res.users)
  • ctx; the context dictionary

To inspect available fields on object, the easiest approach is to temporarily put this in the template body:

<t t-foreach="object._fields" t-as="field">
    <t t-out="field"/>: <t t-out="object[field]"/><br/>
</t>

This iterates over all field names on the model and prints their values.

Or just check the model directly; go to Settings → Technical → Database Structure → Models, find your model (e.g. sale.order), and the Fields tab shows everything available via object.field_name.

Common usage examples:

<t t-out="object.name"/>           <!-- record name -->
<t t-out="object.partner_id.name"/> <!-- related field -->
<t t-out="user.name"/>             <!-- current user -->
<t t-out="object.amount_total"/>   <!-- numeric field -->

For formatted dates/currency use the format_date() and format_amount() helpers available in the template context.

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Add dynamic email reply to link email odoo v16
qweb emailtemplate V16
Avatar
0
ago 24
2555
t-att-href button not rendered in outlook
qweb emailtemplate email_template
Avatar
Avatar
1
mar 23
4798
How to make a email with the orderd products in the body (qweb or jinja2)
qweb emailtemplate jinja2 odoo10
Avatar
2
ago 18
4946
Use QWeb Rendering Engine in Odoo 9 for E-Mail Templates
qweb mass_mailing emailtemplate odoo9
Avatar
Avatar
1
dic 17
7124
Odoo 18: Display image from char field containing url in qweb form
qweb
Avatar
Avatar
1
jul 25
4960
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones empresariales de código abierto que cubre 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