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

Float_time timezone support?

Suscribirse

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

Se marcó esta pregunta
timezonefieldtimedatetimefloat_time
1 Responder
5044 Vistas
Avatar
Alberto

float_time widget does not account for logged in user timezone and that is the only thing I found that can represent Time field but without timezone support it's misleading and bad to use.


Datetime field has this support, read the following example:

For example if I logged in and I have timezone UTC+2 set in settings and I want to create a new record in the web form view on a model that has a Datetime field, if I would enter 

(any date) 08:00h this would get saved in the database as 06:00 because it is always converted to UTC-0 and when it is loaded back it also takes in the account user timezone, so for me it would be displayed as 08:00 even tho it is saved as 06:00


Now above example with Datetime works and is fine. Problem is that float_time DOES NOT take into account the timezone of user when saving. Below is eample with float_time:


class Example(models.Model):
   _name = "example.example"
   _rec_name = "work_time"

   work_time = fields.Float(string='Worktime start', required=True)


My form and tree views are as simple as possible (both have only one field which is work_time, form view is declared as widget="float_time").

If I would create new record with my user who has UTC+2 set as timezone and set work_time to 08:00 this would get saved as 08:00 in the database, without accounting the user timezone. Problem is if another user logs in, with different timezone for example UTC-1, he would still see that record as 08:00 , now think what would happened if both would come to a meeting at 08:00 - they would be 3h apart! For this other user instead of showing it as 08:00 it should show it as 05:00 !


Why is there no proper built in thing for Time field? The above example is one of the most basic things the framework (with major version 14) should support.


Is the only way to hack my own custom field for this?


0
Avatar
Descartar
Avatar
Alberto
Autor Mejor respuesta

I realized not too long after writting this question that there is a flaw with time with timezone support.

You see since it's not tied to date in certain cases,if the timezone difference is big enough,it can happen that for some users time shows as negative (goes into previous day) or larger than 23 (goes into next day). This could be confusing to users and since time is not tied to date we can't normalize it.


So hacking it together would require this field to be tied to date, essentially could use datetime in that case.

Problem is that my form entries would be better and more inuitive if I have separate entry for date (day period) and separate entry for time (work time start/end). I already have a idea how to make the view I want with just using datetime and some compute fields.

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
Error: astimezone() cannot be applied to a naive datetime
timezone time datetime python3 odoo12.0
Avatar
0
abr 21
4990
convert datetime to float - float_time
development widget time datetime float_time
Avatar
Avatar
Avatar
3
jun 15
27820
Report Timezone
timezone time localization datetime UTC
Avatar
0
abr 15
5121
Take Users Timezone Resuelto
timezone datetime
Avatar
Avatar
Avatar
Avatar
3
jul 25
5214
Time & Date Issue Resuelto
timezone datetime
Avatar
Avatar
Avatar
6
sept 19
12448
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