Zum Inhalt springen
Skillpedia
Websites & UI (Frontend)48k · #5349

odoo-qweb-templates

Was er macht

Dieses Tool hilft dir, Dokumentvorlagen (wie PDF-Rechnungen, E-Mails und Website-Seiten) für das Odoo-System zu erstellen. Es erzeugt den nötigen Code, um Informationen strukturiert und dynamisch darzustellen.

Wann du ihn nutzt

  • ✓Einen neuen individuellen PDF-Bericht erstellen.
  • ✓Eine automatische E-Mail-Vorlage entwickeln.
  • ✓Einer Website-Seite dynamische Inhalte hinzufügen.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-qweb-templates/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Erstelle ein QWeb-Template für eine PDF-Rechnung, die den Kundennamen und den Gesamtbetrag zeigt.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Du beschreibst das Dokument, das du brauchst (Bericht, E-Mail oder Seite). Das Tool erzeugt den QWeb-Code und die nötigen Einstellungen, damit Odoo ihn verwenden kann.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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).
Häufige Fragen

Was ist QWeb?

QWeb ist die Sprache, mit der Odoo Dokumentvorlagen erstellt, zum Beispiel PDF-Berichte und E-Mails. So können Informationen dynamisch angezeigt werden.

Was sind Direktiven wie t-if und t-foreach?

Das sind spezielle Befehle in QWeb, die steuern, wie Inhalte angezeigt werden. Zum Beispiel zeigt „t-if“ etwas nur an, wenn eine Bedingung wahr ist, und „t-foreach“ wiederholt einen Abschnitt für jedes Element einer Liste.

Kann ich das für jede Art von Dokument in Odoo nutzen?

Vor allem für PDF-Berichte, E-Mail-Vorlagen und Website-Seiten. Nicht abgedeckt sind komplexe Python-Programmierung für Webseiten oder die Druckeinstellungen für PDFs.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
48k
Platz im Ranking
#5349
Lizenz
MIT
Aktualisiert
15.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills