콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
4727 화면

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
아바타
취소
작성자

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

베스트 답변
<record id="account.account_invoices" model="ir.actions.report"> 
    <field name="print_report_name">'Invoices-%s' % object.number</field>
</record>
아바타
취소
베스트 답변

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

아바타
취소
작성자 베스트 답변

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">


아바타
취소

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

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

</record>

작성자

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

작성자

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?