How to create a new report?

  • language
      English
  • type
      technical
  • info created for version
      14.0
  • mvc
      XML (records/views/templates)
Add to Cart

<template id="report_saleorder_document_2">
    <t t-call="web.external_layout">
        <t t-set="doc" t-value="doc.with_context(lang=doc.partner_id.lang)" />
        <div class="page">
            <div class="oe_structure"/>
...

<template id="report_saleorder_2">
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="doc">
            <t t-call="module_name.report_saleorder_document_2" t-lang="doc.partner_id.lang"/>
        </t>
    </t>
</template>
<record id="action_report_saleorder_2" model="ir.actions.report"> <field name="name">Quotation / Order 2</field> <field name="model">sale.order</field> <field name="report_type">qweb-pdf</field> <field name="report_name">module_name.report_saleorder_2</field>
<field name="report_file">module_name.report_saleorder_2</field>
<field name="print_report_name">(object.state in ('draft', 'sent') and 'Quotation - %s' % (object.name)) or 'Order - %s' % (object.name) </field> <field name="binding_model_id" ref="sale.model_sale_order"/> <field name="binding_type">report</field> </record>