本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)48k · #5349

odoo-qweb-templates

できること

このツールは、Odooで使う帳票のテンプレート(PDFの請求書、メール、Webページなど)を作成するのに役立ちます。情報を整理して動的に表示するために必要なコードを生成します。

使う場面

  • ✓新しいカスタムPDF帳票を作成するとき。
  • ✓自動送信メールのテンプレートを作成するとき。
  • ✓Webページに動的なコンテンツを追加するとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-qweb-templates/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“顧客名と合計金額を表示するPDF請求書用のQWebテンプレートを作成してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

必要な文書(帳票、メール、またはページ)を説明してください。ツールがQWebのコードと、Odooで使うために必要な設定を生成します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Odoo QWeb Templates

Overview

QWeb is Odoo's primary templating engine, used for PDF reports, website pages, and email templates. This skill generates correct, well-structured QWeb XML with proper directives, translation support, and report action bindings.

When to Use This Skill

  • Creating a custom PDF report (invoice, delivery slip, certificate).
  • Building a QWeb email template triggered by workflow actions.
  • Designing Odoo website pages with dynamic content.
  • Debugging QWeb rendering errors (t-if, t-foreach issues).

How It Works

  1. Activate: Mention @odoo-qweb-templates and describe the report or template needed.
  2. Generate: Receive a complete ir.actions.report record and QWeb template.
  3. Debug: Paste a broken template to identify and fix rendering issues.

Examples

Example 1: Custom PDF Report

<!-- Report Action -->
<record id="action_report_patient_card" model="ir.actions.report">
    <field name="name">Patient Card</field>
    <field name="model">hospital.patient</field>
    <field name="report_type">qweb-pdf</field>
    <field name="report_name">hospital_management.report_patient_card</field>
    <field name="binding_model_id" ref="model_hospital_patient"/>
</record>

<!-- QWeb Template -->
<template id="report_patient_card">
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="doc">
            <t t-call="web.external_layout">
                <div class="page">
                    <h2>Patient Card</h2>
                    <table class="table table-bordered">
                        <tr>
                            <td><strong>Name:</strong></td>
                            <td><t t-field="doc.name"/></td>
                        </tr>
                        <tr>
                            <td><strong>Doctor:</strong></td>
                            <td><t t-field="doc.doctor_id.name"/></td>
                        </tr>
                        <tr>
                            <td><strong>Status:</strong></td>
                            <td><t t-field="doc.state"/></td>
                        </tr>
                    </table>
                </div>
            </t>
        </t>
    </t>
</template>

Example 2: Conditional Rendering

<!-- Show a warning block only if the patient is not confirmed -->
<t t-if="doc.state == 'draft'">
    <div class="alert alert-warning">
        <strong>Warning:</strong> This patient has not been confirmed yet.
    </div>
</t>

Best Practices

  • ✅ Do: Use t-field for model fields — Odoo auto-formats dates, monetary values, and booleans correctly.
  • ✅ Do: Use t-out (Odoo 15+) for safe HTML output of non-field strings. Use t-esc only on Odoo 14 and below (it HTML-escapes output).
  • ✅ Do: Call web.external_layout for PDF reports to automatically include the company header, footer, and logo.
  • ✅ Do: Use _lt() (lazy translation) for translatable string literals inside Python report helpers, not inline t-esc.
  • ❌ Don't: Use raw Python expressions inside QWeb — compute values in the model or a report _get_report_values() helper.
  • ❌ Don't: Forget t-as when using t-foreach; without it, you can't access the current record in the loop body.
  • ❌ Don't: Use t-esc where you intend to render HTML content — it will escape the tags and print them as raw text.

Limitations

  • Does not cover website controller routing for dynamic QWeb pages — that requires Python http.route knowledge.
  • Email template QWeb has different variable scope than report QWeb (object vs docs) — this skill primarily focuses on PDF reports.
  • QWeb JavaScript (used in Kanban/Form widgets) is a different engine; this skill covers server-side QWeb only.
  • Does not cover wkhtmltopdf configuration for PDF rendering issues (page size, margins, header/footer overlap).
よくある質問

QWebとは何ですか?

QWebは、Odooが帳票やメールなどのテンプレートを作成するために使う言語です。PDF帳票やメールに情報を動的に表示できます。

t-ifやt-foreachのようなディレクティブとは何ですか?

QWebで表示内容を制御する特別な命令です。たとえば「t-if」は条件が成り立つときだけ内容を表示し、「t-foreach」はリストの各項目ごとにブロックを繰り返し表示します。

Odooのどの種類の文書にも使えますか?

主にPDF帳票、メールテンプレート、Webページに使えます。複雑なWebページのためのPythonプログラミングや、PDF印刷の設定はこの範囲に含まれません。

詳細

作者による元の説明

Expert in Odoo QWeb templating for PDF reports, email templates, and website pages. Covers t-if, t-foreach, t-field, and report actions.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5349
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル