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
    Restauration & Hôtellerie
    • 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
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Bricoleur
    • Matériel informatique & 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
    Parcourir toutes les 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 pour partenaires
    • 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

Error when overriding create on res_partner

S'inscrire

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

Cette question a été signalée
contacts
2 Réponses
3744 Vues
Avatar
Wombat

What would be causing this error? The override code does not do anything but print values. When I comment it out, it works fine. Anyone got any clues??

@api.model
def create(self, vals):
print("CREATE....", vals)
super(ResPartner, self).create(vals)


Here is the error:

Traceback (most recent call last):
  File "/opt/odoosrc/16.0/odoo/odoo/models.py", line 5739, in concat
    if arg._name != self._name:
AttributeError: 'NoneType' object has no attribute '_name'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoosrc/16.0/odoo/odoo/http.py", line 1584, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoosrc/16.0/odoo/odoo/service/model.py", line 134, in retrying
    result = func()
  File "/opt/odoosrc/16.0/odoo/odoo/http.py", line 1611, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoosrc/16.0/odoo/odoo/http.py", line 1808, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoosrc/16.0/odoo/odoo/addons/base/models/ir_http.py", line 149, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoosrc/16.0/odoo/odoo/http.py", line 699, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoosrc/16.0/odoo/addons/web/controllers/dataset.py", line 42, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoosrc/16.0/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoosrc/16.0/odoo/odoo/api.py", line 459, in call_kw
    result = _call_kw_model_create(method, model, args, kwargs)
  File "/opt/odoosrc/16.0/odoo/odoo/api.py", line 439, in _call_kw_model_create
    result = method(recs, *args, **kwargs)
  File "", line 2, in create
  File "/opt/odoosrc/16.0/odoo/odoo/api.py", line 409, in _model_create_multi
    return create(self, [arg])
  File "/opt/odoosrc/16.0/odoo/addons/account/models/partner.py", line 625, in create
    return super().create(vals_list)
  File "", line 2, in create
  File "/opt/odoosrc/16.0/odoo/odoo/api.py", line 410, in _model_create_multi
    return create(self, arg)
  File "/opt/odoosrc/16.0/odoo/addons/partner_autocomplete/models/res_partner.py", line 163, in create
    partners = super(ResPartner, self).create(vals_list)
  File "", line 2, in create
  File "/opt/odoosrc/16.0/odoo/odoo/api.py", line 390, in _model_create_single
    return self.browse().concat(*(create(self, vals) for vals in arg))
  File "/opt/odoosrc/16.0/odoo/odoo/models.py", line 5743, in concat
    raise TypeError(f"unsupported operand types in: {self} + {arg!r}")
TypeError: unsupported operand types in: res.partner() + None

The above server error caused the following client error:
null


0
Avatar
Ignorer
Avatar
Waleed Ali Mohsen
Meilleure réponse

You can try one of the below codes, and make sure to restart the Odoo service and upgrade your module after "Update App Lists"


Note: Both codes are tested in Odoo 16 and working properly.


from odoo import models, api

class ResPartner(models.Model):
_inherit = 'res.partner'

@api.model
def create(self, vals):
print("CREATE....", vals)
return super().create(vals)

   from odoo import models, api

class ResPartner(models.Model):
_inherit = 'res.partner'

@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
print("CREATE..", %vals)
return super().create(vals_list)


   
0
Avatar
Ignorer
Wombat
Auteur

Awesome! that worked!
I still don't understand why the original one did not work but I am very grateful that this one did. Thank you Waleed.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Meilleure réponse

Hi,

Try this Code snippet

class ResPartnerInherit(models.Model):
_inherit='res.partner'

@api.model
def create(self, vals):
print("CREATE....", vals)
return super(ResPartnerInherit, self).create(vals)

Regards

0
Avatar
Ignorer
Wombat
Auteur

Thank you but same error unfortunately.

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é
importing contacts. Getting blocking error: Contacts require a name at multiple rows
contacts
Avatar
Avatar
Avatar
2
oct. 25
1236
Blocking Errors
contacts
Avatar
Avatar
1
oct. 25
937
O18 EE: Completely unknown email addresses in the contacts?
contacts
Avatar
Avatar
Avatar
2
nov. 25
1061
Add contacts to the seller field and not users
contacts
Avatar
Avatar
1
mai 25
2597
Individual address on company contact form
contacts
Avatar
Avatar
1
mars 25
2502
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