Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Error when edit *xml in my first custom module

Subscribe

Get notified when there's activity on this post

This question has been flagged
3 Replies
3425 Views
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
Discard
Avatar
Jignesh Mehta
Best Answer

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
Discard
Avatar
Prashant Panchal (ppa)
Best Answer

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
Discard
Avatar
Hoang Anh
Author Best Answer

I'm done, thanks your comments 

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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