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

Please Help me with this KeyError problem!

S'inscrire

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

Cette question a été signalée
fieldsrelatedkeyerror
8797 Vues
Avatar
Khoa N Phan

I have Student model (which includes studentId field - ID for student, not to be mistaken with student_id) and Course model. I wrote another model StudentCourse to demonstrate the relationship between aforementioned models in which it contains Many2one fields: student_id and course_id respectively. I retrieve studentId by using related field through student_id. After that, in Course model, I input another field student_course_ids (One2many) which references toward student_id. The data retrieved is correctly. However, when i tried to edit student's information in the one2many field (student_course_ids) in Course Form View, I received the following KeyError:

Odoo Server Error
Traceback (most recent call last):
File "/odoo/odoo-server/openerp/http.py", line 648, in _handle_exception
 return super(JsonRequest, self)._handle_exception(exception)
 File "/odoo/odoo-server/openerp/http.py", line 685, in dispatch
 result = self._call_function(**self.params)
 File "/odoo/odoo-server/openerp/http.py", line 321, in _call_function
 return checked_call(self.db, *args, **kwargs)
 File "/odoo/odoo-server/openerp/service/model.py", line 118, in wrapper
 return f(dbname, *args, **kwargs)
 File "/odoo/odoo-server/openerp/http.py", line 314, in checked_call
 result = self.endpoint(*a, **kw)
 File "/odoo/odoo-server/openerp/http.py", line 964, in __call__
 return self.method(*args, **kw)
 File "/odoo/odoo-server/openerp/http.py", line 514, in response_wrap
 response = f(*args, **kw)
 File "/odoo/odoo-server/addons/web/controllers/main.py", line 888, in call_kw
 return self._call_kw(model, method, args, kwargs)
 File "/odoo/odoo-server/addons/web/controllers/main.py", line 880, in _call_kw
 return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
 File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
 return old_api(self, *args, **kwargs)
 File "/odoo/odoo-server/openerp/api.py", line 381, in old_api
 result = method(recs, *args, **kwargs)
 File "/odoo/odoo-server/openerp/models.py", line 6045, in onchange
 record.mapped(field_seq)
 File "/odoo/odoo-server/openerp/models.py", line 5543, in mapped
 recs = recs._mapped_func(operator.itemgetter(name))
 File "/odoo/odoo-server/openerp/models.py", line 5523, in _mapped_func
 vals = [func(rec) for rec in self]
 File "/odoo/odoo-server/openerp/models.py", line 5761, in __getitem__
 return self._fields[key].__get__(self, type(self))
 File "/odoo/odoo-server/openerp/fields.py", line 830, in __get__
 self.determine_value(record)
 File "/odoo/odoo-server/openerp/fields.py", line 939, in determine_value
 self.compute_value(recs)
 File "/odoo/odoo-server/openerp/fields.py", line 894, in compute_value
 self._compute_value(records)
 File "/odoo/odoo-server/openerp/fields.py", line 886, in _compute_value
 self.compute(records)
 File "/odoo/odoo-server/openerp/fields.py", line 587, in _compute_related
 record[self.name] = other[field.name]
 File "/odoo/odoo-server/openerp/models.py", line 5761, in __getitem__
 return self._fields[key].__get__(self, type(self))
KeyError: 'studentId'


I tried to edit the StudentCourse model separately in its own form view and its went through without a hiccup. But the error only occurs at the One2many view in Course model's Form View. Please help me with this. I have been look up for this matter over 3 days and no luck for me. Thanks.

0
Avatar
Ignorer
Esther Martín

Can you post your Code pls?

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é
How to set the default value without a related field?
fields default related
Avatar
Avatar
1
oct. 21
4511
filter field based on the value from other fields
filter fields related
Avatar
Avatar
1
oct. 18
15935
is there any way to pass values from functional field to a related field????
fields on_change related
Avatar
Avatar
1
oct. 15
4993
TypeError: 'int' object has no attribute '__getitem__'
fields related typeerror
Avatar
Avatar
1
mars 15
32246
Field related - one sided relation
fields related change
Avatar
Avatar
1
mars 15
7502
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