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

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

Abonare

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

Această întrebare a fost marcată
errorcontractodoo12OCA
3 Răspunsuri
11472 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Jean Bob

Hi there,

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


Thanks.

Bruce Letterle

Sorry, I did not.

Imagine profil
Faraz Zafar
Cel mai bun răspuns

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
Imagine profil
Abandonează
Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns
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
Imagine profil
Abandonează
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!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
odoo 12 in ubuntu 18.04.4 Error ModuleNotFoundError: No module named 'werkzeug.contrib' Rezolvat
error odoo12
Imagine profil
Imagine profil
Imagine profil
3
sept. 21
13412
Can not tabbing over readonly field in odoo 12. Help me please !!!
error bug odoo12
Imagine profil
0
apr. 24
2335
[sudo] password for odoo: Rezolvat
odoo12 OCA Cybrosys
Imagine profil
Imagine profil
Imagine profil
3
dec. 22
15579
Problems migrating from odoo 12 to odoo 14 Rezolvat
error odoo12 v14
Imagine profil
Imagine profil
2
ian. 21
6204
TypeError: load() missing 1 required positional argument: 'action_id' Rezolvat
error addons odoo12
Imagine profil
Imagine profil
2
apr. 20
74325
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