Ir al contenido
Menú
Se marcó esta pregunta
4 Respuestas
14601 Vistas

Hi,

I have to add new fields in the invoice "account_print_invoice.rml" template.

I guess the easiest way to do it would be to replace "account_report.xml" in "account" module, modifying the invoice report entry:

Original account/account_report.xml:

<report
            auto="False"
            id="account_invoices"
            model="account.invoice"
            name="account.invoice"
            rml="account/report/account_print_invoice.rml"
            string="Invoices"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
            usage="default"
            multi="True"/>

Modified account/account_report.xml (Note RML path has been changed to a location in my module):

<report
            auto="False"
            id="account_invoices"
            model="account.invoice"
            name="account.invoice"
            rml="mymodule/report/account_print_invoice.rml"
            string="Invoices"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
            usage="default"
            multi="True"/>

However I'd prefer not to change any of the files in the account module, keeping account_report.xml unmodified. Is there any way of modifying the "acount.invoice" report configuration by creating a new <report> entry in my module which replaces the rml loaded when generating a new invoice pdf?

Proposed new report entry in my own module: mymodule/account_report.xml

<report
                auto="False"
                id="account_invoices"
                model="account.invoice"
                name="account.invoice"
                rml="mymodule/report/account_print_invoice.rml"
                string="Invoices"
                attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
                usage="default"
                multi="True"/>

Is this approach possible?

Thanks,

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
ago 15
9216
2
mar 15
8949
1
mar 15
4579
2
jun 25
1481
5
nov 24
31771