コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
14841 ビュー

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,

アバター
破棄
関連投稿 返信 ビュー 活動
2
8月 15
9365
2
3月 15
9062
2
8月 25
429
1
3月 15
4812
2
6月 25
1840