Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

error in timesheet.py

Odoberať

Get notified when there's activity on this post

This question has been flagged
errortimesheetodoo8.0
5 Replies
4800 Zobrazenia
Avatar
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
Avatar
Zrušiť
Priyesh Solanki

Can you please provide the whole traceback ?

Avatar
Bhavik Bagadiya
Best Answer

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
Avatar
Zrušiť
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"

Avatar
wizardz
Autor Best Answer

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
Avatar
Zrušiť
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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Integrity error while adding calendar view.
error odoo8.0
Avatar
0
aug 15
3818
After creating a new database, why am I unable to log in it?
error database odoo8.0
Avatar
Avatar
Avatar
3
jún 22
15072
Sending an email with the employee's timesheet by clicking button 'confirm'
email timesheet odoo8.0
Avatar
0
sep 19
5144
How to make timesheet creation monthly in odoo 8 Solved
hr timesheet odoo8.0
Avatar
Avatar
1
nov 16
4263
Problems with Product module
error product odoo8.0
Avatar
Avatar
4
sep 16
3854
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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