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 do I fix ['bool' object has no attribute 'strftime'] error in the contract module?

Tilmeld

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

Dette spørgsmål er blevet anmeldt
errorcontractodoo12OCA
3 Besvarelser
11335 Visninger
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
Kassér
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
Bedste svar

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
Kassér
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Bedste svar
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
Kassér
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!

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
odoo 12 in ubuntu 18.04.4 Error ModuleNotFoundError: No module named 'werkzeug.contrib' Løst
error odoo12
Avatar
Avatar
Avatar
3
sep. 21
13341
Can not tabbing over readonly field in odoo 12. Help me please !!!
error bug odoo12
Avatar
0
apr. 24
2282
[sudo] password for odoo: Løst
odoo12 OCA Cybrosys
Avatar
Avatar
Avatar
3
dec. 22
15457
Problems migrating from odoo 12 to odoo 14 Løst
error odoo12 v14
Avatar
Avatar
2
jan. 21
6131
TypeError: load() missing 1 required positional argument: 'action_id' Løst
error addons odoo12
Avatar
Avatar
2
apr. 20
74176
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