Tutorial: Inherit QWeb Reports
Learn how to modify existing QWeb reports
QWeb
Reports
Inheritance
Overview
This tutorial module teaches you how to inherit and modify existing QWeb reports in Odoo. Learn to add content, modify layouts, and customize standard reports without modifying core code.
What You'll Learn
- Template inheritance with inherit_id
- XPath expressions to target elements
- Position attributes (before, after, inside, replace)
- QWeb directives (t-if, t-field, t-esc)
- Conditional content based on record state
Contains
- Inherits quotation/order report template
- Adds phone and email on quotations
- Adds warning message for draft orders
- Adds custom terms & conditions footer
Key Code Example
<template id="report_custom" inherit_id="sale.report_saleorder_document">
<xpath expr="//div[@name='address']" position="after">
<t t-if="doc.partner_id.phone">
Phone: <span t-field="doc.partner_id.phone"/>
</t>
</xpath>
</template>
Tutorial: Inherit QWeb Reports
Learn how to modify existing QWeb reports
QWeb
Reports
Inheritance
Overview
This tutorial module teaches you how to inherit and modify existing QWeb reports in Odoo. Learn to add content, modify layouts, and customize standard reports without modifying core code.
What You'll Learn
- Template inheritance with inherit_id
- XPath expressions to target elements
- Position attributes (before, after, inside, replace)
- QWeb directives (t-if, t-field, t-esc)
- Conditional content based on record state
Contains
- Inherits quotation/order report template
- Adds phone and email on quotations
- Adds warning message for draft orders
- Adds custom terms & conditions footer
Key Code Example
<template id="report_custom" inherit_id="sale.report_saleorder_document">
<xpath expr="//div[@name='address']" position="after">
<t t-if="doc.partner_id.phone">
Phone: <span t-field="doc.partner_id.phone"/>
</t>
</xpath>
</template>
Technical Information
Version: 19.0.1.0.0
Dependencies: sale
License: OPL-1
Please log in to comment on this module