Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
31263 Lượt xem

I am using Odoo 12 Community edition and I choose a sample for the invoice layout, but I would like to customize it. I found in the Views > report_invoice_document, but this is not the full document, I cannot find how to modify the header and the footer. I tried looking for external_layout_header and external_layout_footer as I read on some other places, but it doesn't exist. Can someone explain to me how could I find out which views are used in the current settings?

Another question would be if there is any external tool to edit and create these Reports and then import them back into Odoo. 


Thanks for your help, I appreciate it.

 

Ảnh đại diện
Huỷ bỏ
Tác giả

I found external_layout_standard has the header and footer

Câu trả lời hay nhất

Hi!! This is an example of a template in which I edit a header in Odoo 12.

<template id="external_layout_header" inherit_id="web.external_layout_standard">
<xpath expr="//div[@class='header']" position="replace">
<div class="header" style="font-family: 'Roboto', sans-serif;
font-weight: bold;">
<img t-if="company.logo"
t-att-src="'data:image/png;base64,%s' % company.logo"
style="height: 100px;
width: 100px;"/>

<div style="margin-top: 15px;
color: blue;
font-size: 12px;"
t-esc="company.name.encode('ascii', 'ignore').upper()"/>
</div>
</xpath>
</template>
Ảnh đại diện
Huỷ bỏ
Tác giả

I tried with the boxed, but it doesn't work for me. I did it in a module. Can you help me how you implemented this exactly? This is what I need actually.

<template id="external_layout_header" inherit_id="web.external_layout_clean">

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

<div class="o_clean_header" style="font-family: 'Roboto', sans-serif;

font-weight: bold;">

<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" alt="Logo"

style="height: 100px;width: 100px;"/>

<div style="margin-top: 15px;

color: blue;

font-size: 12px;"

t-esc="company.name.encode('ascii', 'ignore').upper()"/>

</div>

</xpath>

</template>

remember to include " web "in your dependencies.

Tác giả

It actually works, I forgot to add it in the manifest. Thank you so much!

Câu trả lời hay nhất

But where are these templates available to cloned/edited?  They aren't under Settings | Technical | Email |Templates, where I would expect them to be.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi @Talmid
in Odoo 11 and 12 you can change the reporting template

There are 4 template in odoo:

Standard, Boxed, clean, background

 you can customise the header and footer after if you add your customisation in the 4 template !

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can find the xml where these 4 are in the web module.

odoo/addons/web/views/report_templates.xml

This is the template that contains the 4 Standardtemplates 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Enable developer mode, find external_layout_header​ and external_layout_footer​ in Technical > Views, edit for customizations. Use Odoo Studio or XML editors for advanced designs.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 12 23
14113
1
thg 4 19
3752
0
thg 11 18
3050
3
thg 3 15
4905
1
thg 3 15
4291