我正在尝试为Centos 7上安装的Odoo 11创建一个新模型。在使用该模型时,Odoo不会检测到它。这是模型的结构:
student_contact
models
__init__.py
student.py
views
student_view.py
security
ir.model.acces.csv
__init__.py
__manifest__.py
初始化 .py:
# -*- coding: utf-8-*-
from . import models
清单 .py:
# -*- coding:utf-8 -*-
{
'name': 'fiche',
'version':'12.0.1.0.0',
'summary': 'Record Student Information',
'category': 'Tools',
'author': 'BOUICHE Kheireddine',
'maintainer': 'INSIM Bejaia',
'company': 'INSIM Bejaia',
'website': 'https://www.insim.dz',
'depends': ['base'],
'data': [
'security/ir.model.access.csv',
'views/student_view.xml'
],
'images':[],
'license': 'AGPL-3',
'installable': True,
'application': False,
'auto_install': False,
}
views / student_view.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="student_menu_action" model="ir.actions.act_window">
<field name ="name">Students</field>
<field name ="res_model">student.student</field>
<field name ="view_type">form</field>
<field name ="view_mode">tree, form </field>
<field name ="help" type="html">
<p class="oe_view_nocontent_create"> Create The Firste Student
</p>
</field>
</record>
<menuitem id="school_menu"
name="School" />
<menuitem id="school_student_menu"
parent="school_menu"
name="Student"
action="student_menu_action" />
</data>
</odoo>
models / init .py:
# -*- coding: utf-8 -*-
from . import student
models / student.py:
# -*- coding: utf-8 -*-
from odoo import models, fields
class StudentStudent(models.Model):
_name = 'student.student'
name = fields.Char(string='Name', required=True)
age = fields.Integer(string='Age')
photo = fields.Binary(string='Image')
gender = fields.Selection([('male','Male'),('female','Female'),('others','Others')],string='Gender')
student_dob = fields.Date(string="Date of Birth")
student_blood_group = fields.Selection(
[ ('A+','A+ve'), ('B+','B+ve'),('O+','O+ve'),('AB+','AB+ve'),
('A-','A-ve'),('B-','B-ve'),('O-','O-ve'),('AB-','AB-ve')], string='Blood Group'
)
nationality = fields.Many2one('res.country', string='Nationality')
security / ir.model.access.csv:
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_student_student,access.student.student,model_student_student,base.group_user,1,1,1,0
答案 0 :(得分:0)
结构很好,您有任何错误吗?
还要记住: