Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Error when edit *xml in my first custom module

Odoberať

Get notified when there's activity on this post

This question has been flagged
3 Replies
3464 Zobrazenia
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
Zrušiť
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
Zrušiť
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
Zrušiť
Avatar
Hoang Anh
Autor Best Answer

I'm done, thanks your comments 

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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