Skill

Generate Odoo QWeb Templates and Reports

A skill for generating correct Odoo QWeb templates - PDF reports, email templates, and website pages with proper directives.

Works with odoo

79
Spark score
out of 100
Updated last month
Version 13.1.0

Add to Favorites

Why it matters

Automate the creation of dynamic PDF reports, website pages, and email templates within Odoo using QWeb. This skill ensures correct XML structure, translation support, and report action bindings for efficient Odoo development.

Outcomes

What it gets done

01

Generate QWeb XML for custom PDF reports (invoices, delivery slips).

02

Create QWeb email templates for Odoo workflows.

03

Design Odoo website pages with dynamic content.

04

Debug and fix QWeb rendering errors.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-odoo-qweb-templates | bash

Overview

Odoo QWeb Templates

This skill generates correct Odoo QWeb XML for PDF reports, email templates, and website pages, with proper directives, translation support, and report action bindings, or debugs broken templates. Use it when creating a custom PDF report, QWeb email template, or website page, or debugging QWeb rendering errors. Server-side QWeb only - not website routing, email QWeb scope, or wkhtmltopdf config.

What it does

A skill for generating correct, well-structured QWeb XML - Odoo's primary templating engine used for PDF reports, website pages, and email templates - with proper directives, translation support, and report action bindings. Activation is a three-step flow: mention @odoo-qweb-templates and describe the report or template needed, receive a complete ir.actions.report record plus QWeb template, or paste a broken template to have its rendering issues identified and fixed. A worked example shows a full PDF report: an ir.actions.report record (report_type qweb-pdf, bound to a model via binding_model_id) paired with a QWeb template that calls web.html_container and web.external_layout, loops over docs with t-foreach/t-as, and renders model fields with t-field inside a bordered table. A second example shows conditional rendering with t-if to show a warning block only when a record is in a draft state.

When to use - and when NOT to

Use this skill when 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, or debugging QWeb rendering errors involving t-if or t-foreach. It does not cover website controller routing for dynamic QWeb pages (that requires Python http.route knowledge), email-template QWeb's different variable scope (object vs. docs - this skill focuses primarily on PDF reports), QWeb JavaScript used in Kanban/Form widgets (a different, client-side engine - this skill is server-side QWeb only), or wkhtmltopdf configuration for PDF rendering issues like page size, margins, or header/footer overlap.

Inputs and outputs

Given a description of the report or template needed, it produces an ir.actions.report XML record and a matching QWeb template. Given a broken template, it identifies and fixes the specific rendering issue.

Integrations

Pure Odoo XML/QWeb - no external packages. Best practices baked into generated output: t-field for model fields (auto-formats dates, monetary values, and booleans), t-out (Odoo 15+) for safe HTML output of non-field strings versus t-esc (Odoo 14 and below, which HTML-escapes output), web.external_layout for automatic company header/footer/logo on PDF reports, and _lt() lazy translation for translatable string literals inside Python report helpers rather than inline t-esc. Anti-patterns it avoids: raw Python expressions inside QWeb (compute values in the model or a report's _get_report_values() helper instead), omitting t-as on t-foreach (breaks access to the current record), and using t-esc where HTML rendering is intended (it escapes tags into raw text).

Who it's for

Odoo developers building custom PDF reports, email templates, or website pages who need correctly structured QWeb XML with the right directives and report-action bindings on the first try, or who are debugging an existing template's rendering errors.

Source README

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.

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.