Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

How to export date time as per my timezone in odoo 11?

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
employeeattendance
2 Besvarelser
8562 Visninger
Avatar
Debasish

I tried to export datetime field of Attendance but i am getting wrong date time value. It is giving UTC date time instead my my timezone datetime.

How can i resolve this issue?  Please help me.

0
Avatar
Kassér
Waleed Ali Mohsen

There is no way to export the date in your timezone. You can change it in excel.

Avatar
Debasish
Forfatter Bedste svar

I just update in main.py file of controller of Web module. You can do this in inherit the main.py file.

Import below package in main.py

from dateutil.parser import parse
import datetime
import pytz

-->Update in CSVExport class for CSV. Add below code in this class.

def check_date(self, value):
        try:
            parse_data = parse(value)
            return parse_data
        except Exception as e:
            return False

Update from_data() function like below code.

def from_data(self, fields, rows):
        fp = io.BytesIO()
        writer = pycompat.csv_writer(fp, quoting=1)
        writer.writerow(fields)
        for data in rows:
                row = []
                for d in data:
                        if isinstance(d, pycompat.string_types) and d.startswith(('=', '-', '+')):
                                d = "'" + d
                        if type(d) is str:
                                parse_data = self.check_date(d)
                                if parse_data:
                                        if len(d) > 10:
                                                tz = pytz.timezone(request._context.get('tz'))
                                                d = (pytz.utc.localize(datetime.datetime.strptime(d,'%Y-%m-%d %H:%M:%S')).astimezone(tz)).strftime('%Y-%m-%d %H:%M:%S')

                        row.append(pycompat.to_text(d))
                writer.writerow(row)
        return fp.getvalue()

-->For Excel Update below code in ExcelExportV class in datetime condition.

elif isinstance(cell_value, datetime.datetime):
        tz = pytz.timezone(request._context.get('tz'))
        cell_value = (pytz.utc.localize(cell_value).astimezone(tz)).strftime('%Y-%m-%d %H:%M:%S')
        cell_style = datetime_style

After that, restart your odoo service and check.

2
Avatar
Kassér
Rodrigo Robles

Hello, nice feedback, I will try for my reports; btw, I'm having a problem with UTC-0; some date fields are not getting our correct tz for interpretation in Odoo, like: a ticket in UI shows create_day as 31/07/2019 22:00:00 (UTC -4), but from server (i think its server), it's set at 01/08/2019 02:00:00 (UTC-0), in display while we group it for month it will be shown in August instead of July, that is making trouble for us in all ways, and we don't know if changing the server timezone (have tried but failed) would affect Odoo usage for 1 company or multicompany. You know a way to solve this?

Sorry for commenting on another issue, and forgive me for my english, im not native.

Thanks beforehand.

Rodrigo

Avatar
Ray Carnes (ray)
Bedste svar

All datetime information is exported in the UTC timezone, no matter your local timezone. This is so all Users anywhere in the world can collaborate. If your Business Support team in San Jose, California extracts data and sends it to the New York City office to be updated who then sends it to the London office, the only way this works is with a common underlying timezone. By using UTC we prevent any data corruption due to a User importing data while in a different timezone than the User who exported it. 

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Employee Attendance Resume Per Day
employee attendance
Avatar
0
nov. 24
1605
should OpenERP use calender view in Attendance??
employee attendance
Avatar
0
mar. 15
4248
Attendance: sign in and sign out [Error ! Sign in (resp. Sign out) must follow Sign out (resp. Sign in)]
employee attendance
Avatar
Avatar
1
sep. 25
7240
monitoring Employee Attendance with odoo cloud hosting (usb barcode) Løst
employee attendance barcode
Avatar
Avatar
Avatar
2
jul. 22
4309
[Odoo13] Generate QR Code for Badge Løst
employee attendance badge
Avatar
Avatar
3
feb. 20
7582
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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