跳到正文
Skillpedia
API 与服务器(后端)48k · #5344

odoo-module-developer

它能做什么

这个助手帮你创建和组织 Odoo(一款企业管理系统)的自定义模块。它会指导你搭建文件结构、定义数据,并遵循编程最佳实践。

适用场景

  • ✓需要从零开始在 Odoo 中创建新模块时。
  • ✓想为现有模块添加新功能或新字段时。
  • ✓修复与模块结构或配置有关的错误时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-module-developer/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-module-developer/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“创建一个名为 'inventory_control' 的模块,并为产品添加一个模型。”

每周 5 个新技能,1 分钟读完。

工作原理

你描述想要做的模块,助手会生成基础的文件夹和文件结构,包括主配置文件(__manifest__.py),以及一个用于定义数据(模型)的示例文件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Odoo Module Developer

Overview

This skill transforms your AI into an expert Odoo custom module developer. It guides you through scaffolding new modules, defining models, setting up security, and following Odoo's coding conventions for both Community and Enterprise editions.

When to Use This Skill

  • Starting a new custom Odoo module from scratch.
  • Extending an existing Odoo model (e.g., adding fields to sale.order).
  • Troubleshooting module loading errors or manifest issues.
  • Implementing onchange, compute, and constraint methods correctly.

How It Works

  1. Activate: Mention @odoo-module-developer and describe the module you want to build.
  2. Scaffold: Get the full folder structure with __manifest__.py, __init__.py, models, views, and security files.
  3. Review: Paste existing code and get a review against Odoo best practices.

Examples

Example 1: Scaffold a New Module

Prompt: Create a module called "hospital_management" with a model for patients

Generated structure:

hospital_management/
├── __manifest__.py
├── __init__.py
├── models/
│   ├── __init__.py
│   └── hospital_patient.py
├── views/
│   └── hospital_patient_views.xml
├── security/
│   ├── ir.model.access.csv
│   └── security.xml
└── data/

__manifest__.py:

{
    'name': 'Hospital Management',
    'version': '17.0.1.0.0',
    'category': 'Healthcare',
    'depends': ['base', 'mail'],
    'data': [
        'security/security.xml',
        'security/ir.model.access.csv',
        'views/hospital_patient_views.xml',
    ],
    'installable': True,
    'license': 'LGPL-3',
}

models/hospital_patient.py:

from odoo import models, fields, api

class HospitalPatient(models.Model):
    _name = 'hospital.patient'
    _description = 'Hospital Patient'
    _inherit = ['mail.thread', 'mail.activity.mixin']

    name = fields.Char(string='Patient Name', required=True, tracking=True)
    birth_date = fields.Date(string='Birth Date')
    doctor_id = fields.Many2one('res.users', string='Assigned Doctor')
    state = fields.Selection([
        ('draft', 'New'),
        ('confirmed', 'Confirmed'),
        ('done', 'Done'),
    ], default='draft', tracking=True)

Best Practices

  • ✅ Do: Always prefix your model _name with a namespace (e.g., hospital.patient).
  • ✅ Do: Use _inherit = ['mail.thread'] to add chatter/logging automatically.
  • ✅ Do: Specify version in manifest as {odoo_version}.{major}.{minor}.{patch}.
  • ✅ Do: Set 'author' and 'website' in __manifest__.py so your module is identifiable in the Apps list.
  • ❌ Don't: Modify core Odoo model files directly — always use _inherit.
  • ❌ Don't: Forget to add new models to ir.model.access.csv or users will get access errors.
  • ❌ Don't: Use spaces or uppercase in folder names — Odoo requires snake_case module names.

Limitations

  • Does not cover OWL JavaScript components or frontend widget development — use @odoo-xml-views-builder for view XML.
  • The manifest example targets Odoo 17; verify the exact version and supported module/view syntax. Older Odoo releases also use module manifests; do not infer a nonexistent manifest cutoff.
  • Does not cover multi-company or multi-website configuration; those require additional model fields (company_id, website_id).
  • Does not generate automated test files — use @odoo-automated-tests for that.

The displayed tree is a scaffold, not a complete installable module: supply imports, XML views, named groups, ACLs and record rules before claiming it works. Avoid default broad patient-data access; chatter/tracking can disclose sensitive values, so select fields and followers deliberately. Test installation, multi-record compute/constraints and unauthorized access in a disposable database, never through an unrequested production module upgrade.

常见问题

什么是 Odoo 模块?

模块是一个代码包,用来为 Odoo 系统添加功能,比如销售、库存、财务管理等。

__manifest__.py 文件是什么?

它是每个 Odoo 模块都必需的配置文件,包含模块名称、版本、依赖关系,以及使用了哪些数据文件等信息。

“模型继承”是什么意思?

这是一种在不修改原有代码的情况下,扩展或修改 Odoo 中已有模型(数据表)功能的技术。你可以添加新字段、新方法或新规则。

详情

作者的原始描述

Expert guide for creating custom Odoo modules. Covers __manifest__.py, model inheritance, ORM patterns, and module structure best practices.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5344
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能