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

Error when edit *xml in my first custom module

S'inscrire

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

Cette question a été signalée
3 Réponses
3428 Vues
Avatar
Hoang Anh

my models file

 from openerp import models,fields,api
class Student(models.Model):
     _name="student"
     name = fields.Char('Name',required=True)
     id_student = fields.Char('Student ID',required=True)
     identification = fields.Char('Identification',required=True)
     gender = fields.Selection((('1','Male'),('2','Female'),('3','Other')),'Gender',required=True)
     image = fields.Binary(string="Image")
     birthday = fields.Date('Date of Birth',required=True)
     address = fields.Text()
     phone = fields.Char('Phone number',required=True)
     gpa = fields.Float('Current GPA',required=True)
     classification = fields.Selection((('1','Excellent'),('2','Good'),('3','Average'),('4','Poor')),'Current Classification', compute='set_classification',required=True)
     note = fields.Text()
@api.depends('gpa')
def set_classification(self):
    if self.gpa >= 9.0 :        self.classification = 1
    elif self.gpa < 9 and self.gpa >= 6.5 :
        self.classification = 2
    elif self.gpa < 6.5 and self.gpa >= 5 :
        self.classification = 3
    else :
        self.classification = 4

__openerp__.py

{ 
 "name":"Student Information",
 "category":"ERP Exercise 1",
 "data":['views/student_view.xml',]
}

student_view.xml

<openerp>
     <data>
         <record id="view_student_list" model="ir.ui.view">
             <field name="name">view.student.list</field>
             <field name="model">student</field>
             <field name="arch" type="xml">
                 <tree string="Students">
                     <field name="name"/>
                     <field name="id_student"/>
                     <field name="gender"/>
                     <field name="gpa"/>
                     <field name="classification"/>
                 </tree>
             </field>
         </record>
         <menuitem id="top_menu_students" name="Students" />
         <menuitem id="menu_list_view" name="List view" sequence='5' parent="top_menu_students" action="view_student_list"/>
         <menuitem id="menu_form_view" name="List view" sequence='4' parent="top_menu_students"/>
         <menuitem id="menu_search_view" name="List view" sequence='3' parent="top_menu_students"/>
     </data>
</openerp>

Error

Traceback (most recent call last):
File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 177, in run_wsgi execute(self.server.app)
 File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 165, in execute application_iter = app(environ, start_response)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\service\server.py", line 291, in app return self.app(e, s)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\service\wsgi_server.py", line 216, in application return application_unproxied(environ, start_response)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\service\wsgi_server.py", line 202, in application_unproxied result = handler(environ, start_response)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 1297, in __call__ return self.dispatch(environ, start_response)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 1271, in __call__ return self.app(environ, start_wrapped)
 File "C:\Python27\lib\site-packages\werkzeug\wsgi.py", line 588, in __call__ return self.app(environ, start_response) File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 1444, in dispatch result = ir_http._dispatch()
 File "E:\Projects\ERP\Baitap1\odoo-8.0-20161116\openerp\addons\base\ir\ir_http.py", line 175, in _dispatch return self._handle_exception(e)
 File "E:\Projects\ERP\Baitap1\odoo-8.0-20161116\openerp\addons\base\ir\ir_http.py", line 145, in _handle_exception return request._handle_exception(exception)
File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 673, in _handle_exception return super(HttpRequest, self)._handle_exception(exception)
File "E:\Projects\ERP\Baitap1\odoo-8.0-20161116\openerp\addons\base\ir\ir_http.py", line 171, in _dispatch result = request.dispatch()
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 691, in dispatch r = self._call_function(**self.params)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 317, in _call_function return checked_call(self.db, *args, **kwargs)
File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\service\model.py", line 118, in wrapper return f(dbname, *args, **kwargs)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 314, in checked_call return self.endpoint(*a, **kw)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 810, in __call__ return self.method(*args, **kw)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\http.py", line 410, in response_wrap response = f(*args, **kw)
 File "E:\Projects\ERP\Baitap1\odoo-8.0-20161116\openerp\addons\web\controllers\main.py", line 477, in web_client menu_data = request.registry['ir.ui.menu'].load_menus(request.cr, request.uid, context=request.context)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 268, in wrapper return old_api(self, *args, **kwargs)
 File "<string>", line 2, in load_menus
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\tools\cache.py", line 122, in lookup value = d[key] = self.method(*args, **kwargs)
 File "E:\Projects\ERP\Baitap1\odoo-8.0-20161116\openerp\addons\base\ir\ir_ui_menu.py", line 381, in load_menus menu_root_ids = self.get_user_roots(cr, uid, context=context)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 268, in wrapper return old_api(self, *args, **kwargs)
 File "E:\Projects\ERP\Baitap1\odoo-8.0-20161116\openerp\addons\base\ir\ir_ui_menu.py", line 355, in get_user_roots return self.search(cr, uid, menu_domain, context=context) File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 268, in wrapper return old_api(self, *args, **kwargs)
 File "E:\Projects\ERP\Baitap1\odoo-8.0-20161116\openerp\addons\base\ir\ir_ui_menu.py", line 128, in search result = self._filter_visible_menus(cr, uid, ids, context=context)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 268, in wrapper return old_api(self, *args, **kwargs) File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 399, in old_api result = method(recs, *args, **kwargs)
File "E:\Projects\ERP\Baitap1\odoo-8.0-20161116\openerp\addons\base\ir\ir_ui_menu.py", line 85, in _filter_visible_menus action_menus = menus.filtered('action')
File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 5460, in filtered return self.browse([rec.id for rec in self if func(rec)])
File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 5459, in <lambda> func = lambda rec: filter(None, rec.mapped(name))
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 5435, in mapped recs = recs._mapped_func(operator.itemgetter(name))
File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 5415, in _mapped_func vals = [func(rec) for rec in self]
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 5653, in __getitem__ return self._fields[key].__get__(self, type(self)) File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\fields.py", line 835, in __get__ self.determine_value(record)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\fields.py", line 928, in determine_value record._prefetch_field(self)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 266, in wrapper return new_api(self, *args, **kwargs) File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 3242, in _prefetch_field result = records.read(list(fnames), load='_classic_write')
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 266, in wrapper return new_api(self, *args, **kwargs)
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 3179, in read self._read_from_database(stored, inherited)
File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 266, in wrapper return new_api(self, *args, **kwargs) File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 3382, in _read_from_database record._cache.update(record._convert_to_cache(vals, validate=False))
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 5391, in _convert_to_cache for name, value in values.iteritems()
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\models.py", line 5392, in <dictcomp> if name in fields File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\fields.py", line 1464, in convert_to_cache return record.env[res_model].browse(int(res_id))
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\api.py", line 781, in __getitem__ return self.registry[model_name]._browse(self, ())
 File "E:\Projects\ERP\odoo_8.0.latest\odoo-8.0-20161116\openerp\modules\registry.py", line 102, in __getitem__ return self.models[model_name]
KeyError: u'ir.actions.view'




0
Avatar
Ignorer
Avatar
Jignesh Mehta
Meilleure réponse

Hello Hoang Anh,


Please refer the following link to learn about creating a module in Odoo:

https://www.odoo.com/documentation/9.0/howtos/backend.html


Hope it will helps you.

Thanks,

6
Avatar
Ignorer
Avatar
Prashant Panchal (ppa)
Meilleure réponse

Hello Hoang,

You called from Menuitem to Action then have to need action: ir.actions.act_window like see below code

 

CODE

<record id="action_view_student_list" model="ir.actions.act_window">

     <field name="name">view student list</field>

     <field name="type">ir.actions.act_window</field>

    <field name="res_model">student</field>

     <field name="view_type">form</field>

     <field name="view_mode">tree,form</field>

</record>

<menuitem id="menu_list_view" name="List view" sequence='5' parent="top_menu_students" action="action_view_student_list"/>

0
Avatar
Ignorer
Avatar
Hoang Anh
Auteur Meilleure réponse

I'm done, thanks your comments 

0
Avatar
Ignorer
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
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