Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Float_time timezone support?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
timezonefieldtimedatetimefloat_time
1 Respondre
5055 Vistes
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 Best Answer

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
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Error: astimezone() cannot be applied to a naive datetime
timezone time datetime python3 odoo12.0
Avatar
0
d’abr. 21
5010
convert datetime to float - float_time
development widget time datetime float_time
Avatar
Avatar
Avatar
3
de juny 15
27836
Report Timezone
timezone time localization datetime UTC
Avatar
0
d’abr. 15
5135
Take Users Timezone Solved
timezone datetime
Avatar
Avatar
Avatar
Avatar
3
de jul. 25
5248
Time & Date Issue Solved
timezone datetime
Avatar
Avatar
Avatar
6
de set. 19
12489
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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