跳到正文
Skillpedia
网站与界面(前端)48k · #5356

odoo-xml-views-builder

它能做什么

这个 AI 代理可以帮你编写和修复 Odoo 的 XML 代码。Odoo 是一套企业管理系统。它可以生成表单、列表和看板等视图,用来组织和展示信息。

适用场景

  • ✓创建一个用来录入客户资料的新表单时。
  • ✓在销售界面中添加商品列表时。
  • ✓用可视化看板(Kanban)整理信息,跟踪任务进度时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-xml-views-builder/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“为“Product”模型创建一个 XML 表单,包含 “name”、“price” 和 “description” 字段。”

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

工作原理

你描述需要的视图类型(表单、列表等)以及对应的数据模型。AI 会生成可直接在 Odoo 中使用的 XML 代码,或者帮你检查你已有的代码。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Odoo XML Views Builder

Overview

This skill generates and reviews Odoo XML view definitions for Kanban, Form, List, Search, Calendar, and Graph views. It understands visibility modifiers, groups, domain, context, and widget usage across Odoo versions 14–17, including the migration from attrs (v14–16) to inline expressions (v17+).

When to Use This Skill

  • Creating a new form or list view for a custom model.
  • Adding fields, tabs, or smart buttons to an existing view.
  • Building a Kanban view with color coding or progress bars.
  • Creating a search view with filters and group-by options.

How It Works

  1. Activate: Mention @odoo-xml-views-builder and describe the view you want.
  2. Generate: Get complete, ready-to-paste XML view definitions.
  3. Review: Paste existing XML and get fixes for common mistakes.

Examples

Example 1: Form View with Tabs

<record id="view_hospital_patient_form" model="ir.ui.view">
    <field name="name">hospital.patient.form</field>
    <field name="model">hospital.patient</field>
    <field name="arch" type="xml">
        <form string="Patient">
            <header>
                <button name="action_confirm" string="Confirm"
                    type="object" class="btn-primary"
                    invisible="state != 'draft'"/>
                <field name="state" widget="statusbar"
                    statusbar_visible="draft,confirmed,done"/>
            </header>
            <sheet>
                <div class="oe_title">
                    <h1><field name="name" placeholder="Patient Name"/></h1>
                </div>
                <notebook>
                    <page string="General Info">
                        <group>
                            <field name="birth_date"/>
                            <field name="doctor_id"/>
                        </group>
                    </page>
                </notebook>
            </sheet>
            <chatter/>
        </form>
    </field>
</record>

Example 2: Kanban View

<record id="view_hospital_patient_kanban" model="ir.ui.view">
    <field name="name">hospital.patient.kanban</field>
    <field name="model">hospital.patient</field>
    <field name="arch" type="xml">
        <kanban default_group_by="state" class="o_kanban_small_column">
            <field name="name"/>
            <field name="state"/>
            <field name="doctor_id"/>
            <templates>
                <t t-name="kanban-card">
                    <div class="oe_kanban_content">
                        <strong><field name="name"/></strong>
                        <div>Doctor: <field name="doctor_id"/></div>
                    </div>
                </t>
            </templates>
        </kanban>
    </field>
</record>

Best Practices

  • ✅ Do: Use inline invisible="condition" (Odoo 17+) instead of attrs for show/hide logic.
  • ✅ Do: Use attrs="{'invisible': [...]}" only if you are targeting Odoo 14–16 — it is deprecated in v17.
  • ✅ Do: Always set a string attribute on your view record for debugging clarity.
  • ✅ Do: Use <chatter/> (v17) or <div class="oe_chatter"> + field tags (v16 and below) for activity tracking.
  • ❌ Don't: Use attrs in Odoo 17 — it is fully deprecated and raises warnings in logs.
  • ❌ Don't: Put business logic in view XML — keep it in Python model methods.
  • ❌ Don't: Use hardcoded domain strings in views when a domain field on the model can be used dynamically.

Limitations

  • Does not cover OWL JavaScript widgets or client-side component development.
  • Search panel views (<searchpanel>) are not fully covered — those require frontend knowledge.
  • Does not address website QWeb views — use @odoo-qweb-templates for those.
  • Cohort and Map views (Enterprise-only) are not covered by this skill.
常见问题

Odoo 中的 XML 视图是什么?

它们是定义信息在屏幕上如何呈现给用户的代码片段,比如数据录入表单、商品列表或跟踪看板。

“Kanban”、“Form”和“List”视图分别是什么?

“Form”用于一次查看和编辑一条记录。“List”以行的形式显示多条记录。“Kanban”用卡片来表示每条记录,适合用于工作流程管理。

“Odoo 14-17”是什么意思?

它表示这段代码兼容的 Odoo 版本范围。不同版本之间,代码可能需要做少量调整。

详情

作者的原始描述

Expert at building Odoo XML views: Form, List, Kanban, Search, Calendar, and Graph. Generates correct XML for Odoo 14-17 with proper visibility syntax.

repo: sickn33/agentic-awesome-skills

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能