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

Formatting dates in Qweb report: account.report_overdue_document

Suscribirse

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

Se marcó esta pregunta
dateqwebformatreportdatetime
7 Respuestas
23358 Vistas
Avatar
David Knowles

Hi everyone,


Could someone please offer any assistance with the following;

I am attempting to modify the "Due Payments" report (View name: account.report_overdue_document) to list dates in the UK date format, i.e. for the 18th April 2017, I would like the dates to be shown as: 18/04/2017

I want this format to apply to all dates in the report; i.e. the report issue date and all transaction dates listed in the report.


The key snippets of code to be modified are:


<span t-esc="Date"/>        <!-- Report issue date -->


<tr t-foreach="Lines[o.id][currency]" t-as="line">
                            <td>
                                <span t-esc="line['move_id']"/>
                            </td>
                            <td>
                                <span t-esc="line['date']"/>          <!-- Invoice Date: Needs to be UK date format-->
                            </td>
                            <td>
                                <span t-esc="line['date_maturity']"/> <!-- Due Date: Needs to be UK date format -->
                            </td>


I have tried using a combination of the .strf and t-field options as shown in other posts but I'm obviously not getting the syntax right (I'm still I noob to Odoo!) so any assistance would be grately appreciated. 


Many thanks.

0
Avatar
Descartar
Avatar
Hardik Prajapati (hpr)
Mejor respuesta

Hi  David knowles

<sapn t-esc="datetime.datetime.strptime(your field name, '%Y-%m-%d %H:%M:%S').strftime('%d/%m/%Y')"/>

you should to use this code.

Hope this will help you, Thanks!

5
Avatar
Descartar
Avatar
Gael Torrecillas
Mejor respuesta

hello,

I work on :

<span t-esc="Date"/>

and I try to change the format, and I use :

Date: <span t-esc="Date.strftime('%d-%m-%Y')" /><br/>

"Date" is a "datetime" object, if yours others dates are "datetime" objects so this solution is the right one.

1
Avatar
Descartar
Avatar
Esther Martín
Mejor respuesta

<span t-esc="line['date_maturity']" t-field-options='{"format": "MM/dd/yyyy"}'/>


Change the format to UK format

1
Avatar
Descartar
Avatar
Eugen ȚAGA
Mejor respuesta

Hardik Prajapati solution worked for me, thank you!

<span t-esc="datetime.datetime.strptime(your field name, '%Y-%m-%d %H:%M:%S').strftime('%d/%m/%Y')"/>

0
Avatar
Descartar
Avatar
David Knowles
Autor Mejor respuesta

Hi Esther,

Thanks for your response, I've already tried that syntax and it does not appear to work.

I thought that t-field-options could only be applied to t-fields and not t-esc?


I also tried your second suggestion and the Odoo 10 (CE) server had the following error:


Error to render compiling AST
TypeError: 'NoneType' object has no attribute '__getitem__'
Template: account.report_overdue_document
Path: /templates/t/t/div/div/div[2]/p/span[2]
Node: <span t-esc="formatLang(line['date_maturity'], date=True)"/>



0
Avatar
Descartar
Esther Martín

Try this, the language must be UK

<span t-esc="formatLang(line['date_maturity'], date=True)"/>

David Knowles
Autor

I also tried your second suggestion and the Odoo 10 (CE) server had the following error:

Error to render compiling AST

TypeError: 'NoneType' object has no attribute '__getitem__'

Template: account.report_overdue_document

Path: /templates/t/t/div/div/div[2]/p/span[2]

Node: <span t-esc="formatLang(line['date_maturity'], date=True)"/>

¿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
Qweb report compare a field date with today date Resuelto
date qweb report
Avatar
Avatar
1
feb 25
2252
How to change display of a specific datetime field in a different format on list and form view?
date format datetime
Avatar
0
oct 23
3778
How to change the date format in the Invoice print. Resuelto
invoice date format report
Avatar
Avatar
Avatar
Avatar
3
dic 24
6810
Change US Check printing format
qweb format report Checks
Avatar
Avatar
1
sept 21
5631
How to format numbers in Qweb Reports - OdooV8 Resuelto
qweb format report odooV8
Avatar
Avatar
Avatar
6
dic 23
23532
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