Почему Odoo не обнаруживает созданную мной модель? - PullRequest
0 голосов
/ 09 апреля 2019

Я пытаюсь создать новую модель для Odoo 11, которая устанавливается на Centos 7. Когда дело доходит до использования этой модели, Odoo не обнаруживает ее. Вот структура модели:

student_contact
         models
            __init__.py
            student.py
         views
            student_view.py
         security
            ir.model.acces.csv
         __init__.py
         __manifest__.py

* INIT 1006 * .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,
}

просмотров / 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>

модели / INIT .py:

# -*- coding: utf-8 -*-
from . import student

модели / 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

1 Ответ

0 голосов
/ 15 апреля 2019

Структура хорошая, вы получаете ошибку?

А также помните:

  • Перезагрузите сервер
  • обновить список приложений
  • Затем установите ваш модуль
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...