Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
4 Vastaukset
14861 Näkymät

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
elok. 15
9383
2
maalisk. 15
9069
2
elok. 25
446
1
maalisk. 15
4825
2
kesäk. 25
1865