Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

How to resolve error : time data 'False' does not match format '%Y-%m-%d %H:%M:%S'

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
python3odoo11
2 Replies
82962 Tampilan
Avatar
Dhouha

When i'm trying to do an approve action that modify the hr.attendance fields via a modification request this error shows.I tried to search on the net about this error but the major answer was the format of database not the same with the code but in my case i saw the data of my database but i found the same format is used. Any idea on how can i fix this problem ?


here is my code

here is my code

 @api.multi
def modification_approval(self):     attend_signin_ids = self.env['hr.attendance'].search([('employee_id','=',self.employee_id.id)])
    check_in_date = datetime.datetime.strptime(str(self.time_check_in_1), "%Y-%m-%d %H:%M:%S").date()
    check_out_date = datetime.datetime.strptime(str(self.time_check_out_1), "%Y-%m-%d %H:%M:%S").date()
    for obj in attend_signin_ids:
        attendance_check_in_date = datetime.datetime.strptime(str(obj.check_in), "%Y-%m-%d %H:%M:%S").date()
        attendance_check_out_date = datetime.datetime.strptime(str(obj.check_out), "%Y-%m-%d %H:%M:%S").date()
        if (check_in_date == attendance_check_in_date):
            obj.write({'check_in': self.time_check_in_1,
                       'check_out': self.time_check_out_1})

    return self.write({
        'state': 'approved'
    })

Traceback


Traceback (most recent call last):
File "/opt/openhrms/odoo/http.py", line 651, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/openhrms/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/openhrms/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/openhrms/odoo/http.py", line 693, in dispatch
result = self._call_function(**self.params)
File "/opt/openhrms/odoo/http.py", line 342, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/openhrms/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/openhrms/odoo/http.py", line 335, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/openhrms/odoo/http.py", line 937, in __call__
return self.method(*args, **kw)
File "/opt/openhrms/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/opt/openhrms/addons/web/controllers/main.py", line 938, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/openhrms/addons/web/controllers/main.py", line 926, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/openhrms/odoo/api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/opt/openhrms/odoo/api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/openhrms/addons/sifast_attendance_modification_request/models/hr_attendance_modification_request.py", line 67, in modification_approval
attendance_check_out_date = datetime.datetime.strptime(str(obj.check_out),"%Y-%m-%d %H:%M:%S").date()
File "/usr/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
File "/usr/lib/python3.6/_strptime.py", line 362, in _strptime
(data_string, format))
ValueError: time data 'False' does not match format '%Y-%m-%d %H:%M:%S'


0
Avatar
Buang
Avatar
Thayif kabir
Jawaban Terbai

Hi,

Time data 'False' occurs when that field is not date string or it contains null value, So first make sure that field contains value when function is called. you can use any debugger or pycharm to find out when that field getting 'false'.

2
Avatar
Buang
Avatar
Niyas Raphy (Walnut Software Solutions)
Jawaban Terbai

Hi,

attendance_check_in_date = datetime.datetime.strptime(str(obj.check_in), "%Y-%m-%d %H:%M:%S").date()
attendance_check_out_date = datetime.datetime.strptime(str(obj.check_out), "%Y-%m-%d %H:%M:%S").date()

In the above line of code the value of the obj.check_in or obj,check_out might not contains values. As it does not contain value and when you try to access it or call it, it will return False. So what you have to do is that, use an if statement and check whether it contains value or not.


if obj.check_in:
attendance_check_in_date = datetime.datetime.strptime(str(obj.check_in), "%Y-%m-%d %H:%M:%S").date()
if obj.check_out:
   attendance_check_out_date = datetime.datetime.strptime(str(obj.check_out), "%Y-%m-%d %H:%M:%S").date()


Thanks

0
Avatar
Buang
Kirollos

thank you,

it`s working with the just date.

How I can calculate duration by date & time

for i in self:

if i.start_date and i.end_date:

s_date=datetime.strptime(str(i.start_date), "%Y-%m-%d %H:%M:%S").date()

e_date=datetime.strptime(str(i.end_date), "%Y-%m-%d %H:%M:%S").date()

if s_date < e_date:

result = (e_date - s_date)

i.duration = result

else:

msg = f'{s_date} Must be older than {e_date}'

raise UserError(msg)

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How to set a filter as default filter in odoo Diselesaikan
python3 odoo11
Avatar
Avatar
Avatar
2
Feb 24
17037
How to set default stage to when recruitement record is created Diselesaikan
python3 odoo11
Avatar
Avatar
1
Des 22
5955
How to change the value of a field which depends on other fields automatically ? Diselesaikan
python3 odoo11
Avatar
Avatar
Avatar
2
Des 22
15935
how to modify fields of hr.attendance via a modification request automatically Diselesaikan
python3 odoo11
Avatar
Avatar
Avatar
2
Jun 22
8174
how to update field of attendance via an attendance request modification
python3 odoo11
Avatar
Avatar
Avatar
2
Jun 22
6014
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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