You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Odoo12模块开发报错:Model not found: my.student.name 求助

Fixing "Model not found: my.student.name" Error in Odoo 12

I’ve run into this exact issue before with Odoo models—this error almost always means Odoo isn’t detecting your model definition. Let’s walk through the most common fixes step by step:

1. Check your module’s __init__.py

Odoo needs to explicitly import your model file to load it. Make sure your module’s root __init__.py includes:

from . import model

(If you renamed your model file to something like student.py, adjust the import to match: from . import student)

2. Validate your __manifest__.py configuration

Your module manifest tells Odoo what to load. Double-check these key points:

  • Ensure 'depends' includes 'base' (required for all models)
  • Add your view file to the 'data' list so Odoo loads it
  • Confirm your model’s location is recognized (it’s best practice to put model files in a models/ folder, but if you’re using a root model.py, Odoo should still pick it up if imported correctly)

Example manifest snippet:

{
    'name': 'Student Management',
    'version': '1.0',
    'depends': ['base'],
    'data': [
        'view.xml',
        # Add security file here later if needed
    ],
    'installable': True,
    'auto_install': False,
}

3. Upgrade your module (don’t just install)

After adding a new model, a fresh install might not register the model properly. Go to Odoo’s Apps menu, find your module, and click Upgrade. This forces Odoo to reload all model definitions and view files.

4. Add model access permissions (if needed)

If the model loads but you still get errors, you might be missing access rights. Create a security/ir.model.access.csv file with:

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_my_student_name,my.student.name.access,model_my_student_name,,1,1,1,1

Then add this file to your manifest’s 'data' list and upgrade the module again.

5. Double-check for typos

It sounds obvious, but confirm the model name my.student.name is spelled exactly the same in both your model’s _name attribute and your view’s model field—even a single typo will break everything.

Start with steps 1-3 first; those resolve 90% of "model not found" cases in Odoo 12.

内容的提问来源于stack exchange,提问作者MUHAMMEDMUKTHAR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:21:46