Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
18803 Widoki

I am using Odoo 14, I would like to customize the header of 'report_invoice_document'. I tried to add this code:


<?xml version="1.0" encoding="utf-8"?>

  <odoo>

     <data>

       <template id="report_invoice_extend" inherit_id="account.report_invoice_document">

        <t t-call="my_module.external_layout_footer_inherit_cr">

    

        </t>

     </template>

    </data>

 </odoo>



<?xml version="1.0" encoding="utf-8"?>

<odoo>

<template id="external_layout_footer_inherit_cr"

            inherit_id="report.external_layout_footer">

            <xpath expr="//div[@class='footer']" position="replace">

                <div class="footer">

                    <span>Test</span>

                </div>

            </xpath>

        </template>

</odoo>


But I got this error :

raise ValueError(formatted_message).with_traceback(from_traceback) from from_exception odoo.exceptions.ValidationError: Error while validating view:

Element '<t t-call="my_module.external_layout_footer_inherit_cr">' cannot be located in parent view

What's wrong in my code? Any help please.

Awatar
Odrzuć
Najlepsza odpowiedź

Hello, you should just exchange the second portion of the coding with the first one. You should not be calling a template before creating it. I guess that will solve this problem. 

<?xml version="1.0" encoding="utf-8"?>


<odoo>


<template id="external_layout_footer_inherit_cr"


            inherit_id="report.external_layout_footer">


            <xpath expr="//div[@class='footer']" position="replace">


                <div class="footer">


                    <span>Test</span>


                </div>


            </xpath>


        </template>


</odoo>

<?xml version="1.0" encoding="utf-8"?>


  <odoo>


     <data>


       <template id="report_invoice_extend" inherit_id="account.report_invoice_document">


        <t t-call="my_module.external_layout_footer_inherit_cr">


    


        </t>


     </template>


    </data>


 </odoo>

Awatar
Odrzuć
Najlepsza odpowiedź

see this may help you 

https://www.odoo.com/forum/help-1/how-to-edit-default-header-footer-of-the-invoice-pdf-reports-160775

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
sie 24
6625
1
paź 22
24310
2
wrz 21
13020
1
sie 21
8511
1
lip 21
4502