2

I have created qweb report for account.invoice model in ODOO.

Problem:

While we download report in pdf it named as module_name.report_name like in my case it is

"custom_reports_ept.report_export_invoice".

What I want to do is to set downloadable pdf name to "Export Invoice" or "Invoice VDG290-15-16" (VDG290-15-16 is invoice Number)".

How could I do this ?

Here is my xml code,

<report 
    string="Export Invoice" 
    id="account.invoice_export" 
    model="account.invoice" 
    report_type="qweb-pdf"
    name="custom_reports_ept.report_export_invoice" 
    file="custom_reports_ept.report_export_invoice" 
/>

Here is the qweb template.

    <template id="report_export_invoice">
        <t t-call="report.html_container">
            <t t-foreach="docs" t-as="o">
                <div class="page">
                    <div class="oe_structure"/>
                    <!-- report body -->
                </div>
            </t>
        </t>
     </template>
ChesuCR
  • 9,352
  • 5
  • 51
  • 114

1 Answers1

0

I did some search on this point,

  1. In our default odoo we have report module,
  2. got to controllers --> main.py
  3. you can find this object def report_download(self, data, token):
  4. in this function "docids" variables, using this you can get find id of invoice record.
  5. reportname field is contain report name
  6. use this condition:

    if reportname == 'sale.report_saleorder': #browse invoice object here and generate new name as per your requirement

Garf365
  • 3,619
  • 5
  • 29
  • 41