How to Create a New QWeb Template Using an Existing One as a Base

When creating a new QWeb template in Odoo that is very similar to an existing one, which still needs to be left unchanged, there is no need to rewrite the whole code from the existing template. Instead, it is enough to inherit it with flag primary=True and to make the required changes for the new template.

For example, If a new report is needed in the Sale module, that is very similar to the existing one, but the existing one is still required as it is, the definition for the new report template should look like following:

<odoo>
    <template id="new_report_saleorder_document" inherit_id="sale.report_saleorder_document" primary="True">
        <!-- Here goes the customization part -->
    <template/>
</odoo>