Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
4680 Weergaven

Hello,

I would like to change PDF Invoice name for attached file witch generate from PDF Menu. I know how to do this from interface using Settings -> Technical -> Reports, but I would like to make this in my custom module. I do not have idea how. Now the name of file is 300000001.pdf but I would like to be Invoice-3000000001.pdf.

Thanks a lot
Avatar
Annuleer
Auteur

It is urgent. I will be happy if someone can help us.

Beste antwoord
<record id="account.account_invoices" model="ir.actions.report"> 
    <field name="print_report_name">'Invoices-%s' % object.number</field>
</record>
Avatar
Annuleer
Beste antwoord

Hi,
You have to find the external id of the report. Then you have to create an XML file and add a record.

<record id=”external_id” model=”account.move”>
<field name=”print_report_name”>new name</field>
</record>

Here replace the external Id with the actual external id of the original report. You can also generate file names using functions. If the standard report may generate the file name from a function. So you have to change or override the function also.

Hope it helps

Avatar
Annuleer
Auteur Beste antwoord

I ask for odoo v.14. I try this one, but doenst work:


<record id="report_invoice_document_inherit_generix" model="ir.actions.report">
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">account.report_invoice_document</field>
<field name="report_file">account.report_invoice_document</field>
<field name="print_report_name">'Invoice-%s' % (object.name)</field>
</record>


I have one xml file where I inherit invoice template and I start with this code, and everything work there and print my template, but I dont know how to change file name:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_document_inherit_generix" inherit_id="account.report_invoice_document">
<xpath expr="//t[@t-call='web.external_layout']" position="replace">


Avatar
Annuleer

<record id="account.account_invoices" model="ir.actions.report">

<field name="print_report_name">'Invoices-%s' % object.number</field>

</record>

Auteur

Thanks, but does not work. Nothing change. The name is the same.

Auteur

Kiran thanks for your ideas but doesnt work. Maybe the idea to inherit the class is the best but I do not have idea how to do. Can you help?