Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

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

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
errorcontractodoo12OCA
3 Réponses
11408 Vues
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
Ignorer
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
Meilleure réponse

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
Ignorer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Meilleure réponse
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
Ignorer
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.

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
odoo 12 in ubuntu 18.04.4 Error ModuleNotFoundError: No module named 'werkzeug.contrib' Résolu
error odoo12
Avatar
Avatar
Avatar
3
sept. 21
13397
Can not tabbing over readonly field in odoo 12. Help me please !!!
error bug odoo12
Avatar
0
avr. 24
2317
[sudo] password for odoo: Résolu
odoo12 OCA Cybrosys
Avatar
Avatar
Avatar
3
déc. 22
15529
Problems migrating from odoo 12 to odoo 14 Résolu
error odoo12 v14
Avatar
Avatar
2
janv. 21
6179
TypeError: load() missing 1 required positional argument: 'action_id' Résolu
error addons odoo12
Avatar
Avatar
2
avr. 20
74257
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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