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

How do I fix ['bool' object has no attribute 'strftime'] error in the contract module?

Odoberať

Get notified when there's activity on this post

This question has been flagged
errorcontractodoo12OCA
3 Replies
11476 Zobrazenia
Avatar
Russ Schneider

Odoo 12 CE - Ubuntu

All of a sudden, the scheduled action for the \contract module (Generate Recurring Invoices from Contracts) which calls: 

model.cron_recurring_create_invoice()

Is throwing the following error:

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo12/odoo/odoo/tools/safe_eval.py", line 352, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract.py", line 633, in cron_recurring_create_invoice
    invoices |= contracts_to_invoice._recurring_create_invoice(date_ref)
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract.py", line 618, in _recurring_create_invoice
    invoices_values = self._prepare_recurring_invoices_values(date_ref)
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract.py", line 587, in _prepare_recurring_invoices_values
    invoice_values=invoice_values,
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract_line.py", line 698, in _prepare_invoice_line
    name = self._insert_markers(dates[0], dates[1])
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract_line.py", line 747, in _insert_markers
    name = name.replace('#END#', last_date_invoiced.strftime(date_format))
AttributeError: 'bool' object has no attribute 'strftime'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo12/odoo/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo12/odoo/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo12/odoo/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/opt/odoo12/odoo/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo12/odoo/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo12/odoo/odoo/service/model.py", line 98, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo12/odoo/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo12/odoo/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo12/odoo/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo12/odoo/addons/web/controllers/main.py", line 967, in call_button
    action = self._call_kw(model, method, args, {})
  File "/opt/odoo12/odoo/addons/web/controllers/main.py", line 955, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo12/odoo/odoo/api.py", line 759, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo12/odoo/odoo/api.py", line 746, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo12/odoo/odoo/addons/base/models/ir_cron.py", line 83, in method_direct_trigger
    self.sudo(user=cron.user_id.id).ir_actions_server_id.run()
  File "/opt/odoo12/odoo/odoo/addons/base/models/ir_actions.py", line 543, in run
    res = func(action, eval_context=eval_context)
  File "/opt/odoo12/odoo/addons/website/models/ir_actions.py", line 57, in run_action_code_multi
    res = super(ServerAction, self).run_action_code_multi(action, eval_context)
  File "/opt/odoo12/odoo/odoo/addons/base/models/ir_actions.py", line 434, in run_action_code_multi
    safe_eval(action.sudo().code.strip(), eval_context, mode="exec", nocopy=True)  # nocopy allows to return 'action'
  File "/opt/odoo12/odoo/odoo/tools/safe_eval.py", line 375, in safe_eval
    pycompat.reraise(ValueError, ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr)), exc_info[2])
  File "/opt/odoo12/odoo/odoo/tools/pycompat.py", line 86, in reraise
    raise value.with_traceback(tb)
  File "/opt/odoo12/odoo/odoo/tools/safe_eval.py", line 352, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract.py", line 633, in cron_recurring_create_invoice
    invoices |= contracts_to_invoice._recurring_create_invoice(date_ref)
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract.py", line 618, in _recurring_create_invoice
    invoices_values = self._prepare_recurring_invoices_values(date_ref)
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract.py", line 587, in _prepare_recurring_invoices_values
    invoice_values=invoice_values,
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract_line.py", line 698, in _prepare_invoice_line
    name = self._insert_markers(dates[0], dates[1])
  File "/opt/odoo12/odoo-custom-addons/contract/models/contract_line.py", line 747, in _insert_markers
    name = name.replace('#END#', last_date_invoiced.strftime(date_format))
ValueError: <class 'AttributeError'>: "'bool' object has no attribute 'strftime'" while evaluating
'model.cron_recurring_create_invoice()'
0
Avatar
Zrušiť
Jean Bob

Hi there,

I am facing the exact same issue. Did you find a fix please ?


Thanks.

Bruce Letterle

Sorry, I did not.

Avatar
Faraz Zafar
Best Answer

check it in contracts which contract line is having manual renewal needed, and also check if in any contract you missed marking the product in the product line. As both these conditions can lead to cron being not able to execute.

0
Avatar
Zrušiť
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer
Hi,
The error is because of the field last_date_invoiced has no value stored. The value in that field is False. And that's why we can't use any datetime functionality (here:- strftime()) in it.

Either you can solve the issue by providing a valid date in that field or use the below code

current_date = datetime.date.today()
last_date_invoiced = last_date_invoiced or current_date
name = name.replace('#END#', last_date_invoiced.strftime(date_format))
Or 
Simply set a validation condition before the statement ie,

if last_date_invoiced:
name = name.replace('#END#', last_date_invoiced.strftime(date_format)

Hope it helps

-2
Avatar
Zrušiť
cabrejua

It won't solve the error at all. I mean, for sure it will work in order to fix the AttributeError, but last_date_invoiced is a computed value, which is calculated many times in the code: _insert_markers(), _update_recurring_next_date() ...

So, due to that value will be False when calculated, it will throw a new error, given that this field is manipulated so many times.

I think it is a bug that OCA should take care of.

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
odoo 12 in ubuntu 18.04.4 Error ModuleNotFoundError: No module named 'werkzeug.contrib' Solved
error odoo12
Avatar
Avatar
Avatar
3
sep 21
13413
Can not tabbing over readonly field in odoo 12. Help me please !!!
error bug odoo12
Avatar
0
apr 24
2335
[sudo] password for odoo: Solved
odoo12 OCA Cybrosys
Avatar
Avatar
Avatar
3
dec 22
15582
Problems migrating from odoo 12 to odoo 14 Solved
error odoo12 v14
Avatar
Avatar
2
jan 21
6206
TypeError: load() missing 1 required positional argument: 'action_id' Solved
error addons odoo12
Avatar
Avatar
2
apr 20
74327
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