Skip to Content
This question has been flagged
4 Replies
13380 Views

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
Discard
Related Posts Replies Views Activity
2
Aug 15
8104
2
Mar 15
7937
1
Mar 15
3720
3
Jul 24
6866
4
May 24
4250