Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

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

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

Creating a new model in the module

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
4 Trả lời
12368 Lượt xem
Ảnh đại diện
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
Ảnh đại diện
Huỷ bỏ
Yvan

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

badr elmar
Tác giả

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.

Ảnh đại diện
badr elmar
Tác giả Câu trả lời hay nhất
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
Ảnh đại diện
Huỷ bỏ
Manali Kalariya

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

badr elmar
Tác giả

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.

Ảnh đại diện
Manali Kalariya
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
badr elmar
Tác giả

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
Tác giả

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

Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة 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 là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

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