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

Creating a new model in the module

Subscribe

Get notified when there's activity on this post

This question has been flagged
4 Replies
12343 Views
Avatar
badr elmar

Well, you can understand my problem if you have read the title.

i have used the building module tutorial to develop a new module but when i create a new model (Session model for example), and add a view in my XML, i get an error from the system. 

Best regards,

1
Avatar
Discard
Yvan

Hi, please post the complete error traceback, otherwise it will be difficult to help you. Yvan

badr elmar
Author

Traceback (most recent call last): File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 537, in _handle_exception File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 574, in dispatch File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 310, in _call_function File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\service\model.py", line 118, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 307, in checked_call File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 803, in __call__ File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 403, in response_wrap File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\web\controllers\main.py", line 948, in call_button File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\base\module\module.py", line 534, in button_immediate_upgrade File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\base\module\module.py", line 495, in _button_immediate_function File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\registry.py", line 370, in new File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\loading.py", line 351, in load_modules File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\loading.py", line 255, in load_marked_modules File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\loading.py", line 176, in load_module_graph File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\loading.py", line 118, in _load_data File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\tools\convert.py", line 901, in convert_file File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\tools\convert.py", line 987, in convert_xml_import File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\tools\convert.py", line 853, in parse File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\tools\convert.py", line 763, in _tag_record File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\base\ir\ir_model.py", line 1064, in _update File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\base\ir\ir_ui_view.py", line 255, in create File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 360, in old_api File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\models.py", line 4094, in create File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 254, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 496, in new_api File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\models.py", line 4285, in _create File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 254, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\models.py", line 1272, in _validate_fields ParseError: "ValidateError Champ(s) `arch` en erreur vis \xe0 vis de la contrainte : Invalid view definition D\xe9tails de l'erreur : Mod\xe8le introuvable: openacademy.session Contexte de l'erreur : Vue `session.form` [view_id: 337, xml_id: n/a, model: openacademy.session, parent_id: n/a] " while parsing file:///C:/Program Files (x86)/Odoo 8.0-20160106/server/openerp/addons/academy/views/openacademy.xml:77, near session.form openacademy.session This is the error traceback after adding the class Session to the models.py and adding the session view to the XML ; Sessions openacademy.session form tree,form session.form openacademy.session This is the XML added to the XML file.

Avatar
badr elmar
Author Best Answer
It's look like the system don't create the table contact in the database.

What can U propose to resolve that.

Thank U again for your answers.
1
Avatar
Discard
Manali Kalariya

I think you did not add your .py file into the __init__.py file

badr elmar
Author

I have already add the .py file last week but it was not working. I am right when i am saying that the reason why i get an error it's that there was no table for the models created in .py file in the DB. Today, i have made a lot of update. Finally, i have got the table created in the DB. Then, i insert the view to XML file. Consequently, IT'S WORKS. I don't know why exactly but the error was generated because there was no table in DB. Thank U very much for your help.

Avatar
Manali Kalariya
Best Answer

Hi,

First of all create .py file for the creating model suppose name is contact.py

contact.py

from openerp import fields,models

class contact(models.Model):

_name="contact"

#fields of contact model

name=fields.Char(string="Name",required=True)

nick_name=fields.Char(string="Nick Name")

birth_date=fields.Date(string="Date Of Birth")

==> add this demo.py file into the __init__.py of your particular module

__init__.py

import contact.py

==> now you have to create view for the display this model

contact_view.xml

<openerp>

<data>

<!-- Contact Tree view -->

<record model="ir.ui.view" id="contact_view_tree">

<field name="name">contact.view.tree</field>

<field name="model">contact</field>

<field name="arch" type="xml">

<tree string="tree">

<field name="name"/>

<field name="nick_name"/>

<field name="birth_date"/>

</tree>

</field>

</record>

<record model="ir.ui.view" id="contact_view_form">

<field name="name">contact.view.form</field>

<field name="model">contact</field>

<field name="priority" eval="16"/>

<field name="arch" type="xml">

<form string="form">

<sheet>

<group>

<field name="name"/>

<field name="nick_name"/>

<field name="birth_date"/>

</group>

</sheet>

</form>

</field>

</record>

<!-- Action -->

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

<field name="name">Contact</field>

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

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

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

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

</record>

<!-- Contact Menu -->

<menuitem id="contact_menu" action="contact_action" name="Contact" sequence="16"/>

</data>

</openerp>

==> now you have to add the contact_view.xml file into the __opeerp__.py file

__openerp__.py

# -*- coding: utf-8 -*-

{

'name' : 'Contact Module',

'summary' : 'Contact Module',

'version' : '1.0',

'description' : "Contact Module",

'author' : 'Emipro Technologies',

'website' : 'www.emiprotechnologies.com',

'license' : 'AGPL-3',

'category' : 'Uncategorized',

'depends' : [ 'base'],

'data' : [ 'contact_view.xml']

}

==> Restart your Server and update your module list ,Now you can see your view through the Contact menu.

Note :--

Already I'll try your code in my Module it's working proper so I think Error may be an write down wrong Model name or the Wrong Parent Menu name

1
Avatar
Discard
badr elmar
Author

Thank U for your answer but I get the same error : Traceback (most recent call last): File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 537, in _handle_exception File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 574, in dispatch File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 310, in _call_function File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\service\model.py", line 118, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 307, in checked_call File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 803, in __call__ File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\http.py", line 403, in response_wrap File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\web\controllers\main.py", line 948, in call_button File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\base\module\module.py", line 534, in button_immediate_upgrade File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\base\module\module.py", line 495, in _button_immediate_function File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\registry.py", line 370, in new File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\loading.py", line 351, in load_modules File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\loading.py", line 255, in load_marked_modules File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\loading.py", line 176, in load_module_graph File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\modules\loading.py", line 118, in _load_data File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\tools\convert.py", line 901, in convert_file File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\tools\convert.py", line 987, in convert_xml_import File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\tools\convert.py", line 853, in parse File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\tools\convert.py", line 763, in _tag_record File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\base\ir\ir_model.py", line 1064, in _update File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\openerp\addons\base\ir\ir_ui_view.py", line 255, in create File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 256, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 360, in old_api File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\models.py", line 4094, in create File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 254, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 496, in new_api File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\models.py", line 4285, in _create File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\api.py", line 254, in wrapper File "C:\Program Files (x86)\Odoo 8.0-20160106\server\.\openerp\models.py", line 1272, in _validate_fields ParseError: "ValidateError Champ(s) `arch` en erreur vis \xe0 vis de la contrainte : Invalid view definition D\xe9tails de l'erreur : Mod\xe8le introuvable: contact Contexte de l'erreur : Vue `contact.view.tree` [view_id: 346, xml_id: n/a, model: contact, parent_id: n/a] " while parsing file:///C:/Program Files (x86)/Odoo 8.0-20160106/server/openerp/addons/academy/views/openacademy.xml:79, near contact.view.tree contact

badr elmar
Author

I am still searching for the solution. if you have more issues to fix this problem, please post all of them. Best regards

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