Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

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

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

Creating a new model in the module

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
12358 มุมมอง
อวตาร
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
อวตาร
ละทิ้ง
Yvan

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

badr elmar
ผู้เขียน

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.

อวตาร
badr elmar
ผู้เขียน คำตอบที่ดีที่สุด
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
อวตาร
ละทิ้ง
Manali Kalariya

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

badr elmar
ผู้เขียน

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.

อวตาร
Manali Kalariya
คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
badr elmar
ผู้เขียน

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
ผู้เขียน

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

สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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 เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

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