Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

error in timesheet.py

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
errortimesheetodoo8.0
5 Răspunsuri
4783 Vizualizări
Imagine profil
wizardz

What is this error? How can I fix it: 


File "/opt/custom_addons/hr_presence/hr_timesheet.py", line 81, in _holidays
    start_date = datetime.datetime.strptime(record.date_from, '%Y-%m-%d')
0
Imagine profil
Abandonează
Priyesh Solanki

Can you please provide the whole traceback ?

Imagine profil
Bhavik Bagadiya
Cel mai bun răspuns

Hello Wizardz

Try this code 

first import 

from datetime import datetime

from openerp.tools import DEFAULT_SERVER_DATE_FORMAT

then use

start_date = datetime.strptime(record.date_from, DEFAULT_SERVER_DATE_FORMAT)

Thanx

0
Imagine profil
Abandonează
wizardz
Autor

start_date = datetime.datetime.strptime(record.date_from, str(DEFAULT_SERVER_DATE_FORMAT)) TypeError: must be string, not bool How can I make this column in a string ?

wizardz
Autor

when I say date_from and date_to at the beginning of the record with a string '2000-01-01' it works.

Bhavik Bagadiya

can you tell what record.date_from returns value? because if record.date_from returns datetime then only it converts in date, if it returns true,false then not possible in date

wizardz
Autor

The return of record.date_from and record.date_to are "False"

Imagine profil
wizardz
Autor Cel mai bun răspuns

Traceback (most recent call last):
  File "/opt/odoo/src/openerp/http.py", line 537, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/src/openerp/http.py", line 574, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/src/openerp/http.py", line 310, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/src/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/src/openerp/http.py", line 307, in checked_call
    return self.endpoint(*a, **kw)
  File "/opt/odoo/src/openerp/http.py", line 803, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/src/openerp/http.py", line 403, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/src/openerp/addons/web/controllers/main.py", line 944, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/src/openerp/addons/web/controllers/main.py", line 936, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/opt/odoo/src/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/src/openerp/api.py", line 399, in old_api
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/src/openerp/models.py", line 5920, in onchange
    record = self.new(values)
  File "/opt/odoo/src/openerp/api.py", line 266, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/src/openerp/models.py", line 5484, in new
    record._cache.update(record._convert_to_cache(values, update=True))
  File "/opt/odoo/src/openerp/models.py", line 5379, in _convert_to_cache
    for name, value in values.iteritems()
  File "/opt/odoo/src/openerp/models.py", line 5380, in <dictcomp>
    if name in fields
  File "/opt/odoo/src/openerp/fields.py", line 1572, in convert_to_cache
    return record.env[self.comodel_name].new(value)
  File "/opt/odoo/src/openerp/api.py", line 266, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/src/openerp/models.py", line 5484, in new
    record._cache.update(record._convert_to_cache(values, update=True))
  File "/opt/odoo/src/openerp/models.py", line 5379, in _convert_to_cache
    for name, value in values.iteritems()
  File "/opt/odoo/src/openerp/models.py", line 5380, in <dictcomp>
    if name in fields
  File "/opt/odoo/src/openerp/fields.py", line 1640, in convert_to_cache
    ids = OrderedSet(record[self.name].ids)
  File "/opt/odoo/src/openerp/models.py", line 5641, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/opt/odoo/src/openerp/fields.py", line 834, in __get__
    self.determine_draft_value(record)
  File "/opt/odoo/src/openerp/fields.py", line 942, in determine_draft_value
    self._compute_value(record)
  File "/opt/odoo/src/openerp/fields.py", line 881, in _compute_value
    self.compute(records)
  File "/opt/odoo/src/openerp/api.py", line 266, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/saas_addons/hr_presence/hr_timesheet.py", line 84, in _holidays
    start_date = datetime.datetime.strptime(record.date_from, '%Y-%m-%d')
TypeError: must be string, not bool


and this is the modul where the error comes from:


@api.multi

def _holidays(self):

for record in self:

start_date = datetime.datetime.strptime(str(record.date_from), '%Y-%m-%d') #error this line

end_date = datetime.datetime.strptime(record.date_to, '%Y-%m-%d') #error this line

end_date = end_date.replace(hour=23, minute=59, second=59)

date_start = str(start_date)

date_end = str(end_date)

record.holiday_ids = self.env['hr.holidays'].search(

['&', '&', ('employee_id', '=', record.employee_id.id), ('state', 'in', ['confirm', 'validate1', 'validate']),

'|',

'|',

'&', ('date_from', '>=', date_start), ('date_from', '<=', date_end),

'&', ('date_to', '>=', date_start), ('date_to', '<=', date_end),

'&', ('date_from', '<=', date_start), ('date_to', '>=', date_end)

])

0
Imagine profil
Abandonează
Pawan

Wizards, Please check if you have set date_from value, as its getting date_from as False

wizardz
Autor

how ?

Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Integrity error while adding calendar view.
error odoo8.0
Imagine profil
0
aug. 15
3802
After creating a new database, why am I unable to log in it?
error database odoo8.0
Imagine profil
Imagine profil
Imagine profil
3
iun. 22
15057
Sending an email with the employee's timesheet by clicking button 'confirm'
email timesheet odoo8.0
Imagine profil
0
sept. 19
5138
How to make timesheet creation monthly in odoo 8 Rezolvat
hr timesheet odoo8.0
Imagine profil
Imagine profil
1
nov. 16
4257
Problems with Product module
error product odoo8.0
Imagine profil
Imagine profil
4
sept. 16
3841
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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