如何解决 Qweb 报告中的重叠问题?

时间:2021-06-05 10:42:19

标签: report odoo overlapping

我正在编写一些报告,但在页眉和页脚区域遇到了重叠问题。我阅读了一些关于这个主题的类似帖子(降级 wkhtmltopdf,编辑纸张边距/页眉间距),但没有一个对我有用。任何人都可以就如何解决这个问题给我建议,我目前使用的是 Odoo 版本 14。重叠不仅发生在表格中,而且还发生在具有引导类行的常规 div 元素中。

纸张格式:

    <record id="paperformat_report_quotation_models_contract" model="report.paperformat">
        <field name="name">European A4</field>
        <field name="default" eval="True"/>
        <field name="format">A4</field>
        <field name="page_height">0</field>
        <field name="page_width">0</field>
        <field name="orientation">Portrait</field>
        <field name="margin_top">50</field>
        <field name="margin_bottom">32</field>
        <field name="margin_left">0</field>
        <field name="margin_right">0</field>
        <field name="header_line" eval="False"/>
        <field name="header_spacing">38</field>
        <field name="dpi">90</field>
    </record>

为了在页眉的右上角放置两个图像,我没有左边距或右边距,但我创建了一个自定义 CSS 类,用于为页面内容分配边距。

.contract_paper {
margin: 0 25mm;
font-family: 'Montserrat', sans-serif;
}

重叠的 HTML 元素

 <div class="row contract_space_text">
        <div class="col-12">
              <span>
                   Some text.
              </span>
        </div>
 </div>

.contract_space_text {
padding-top: 14px;
}

自定义文档布局

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

    <template id="contact_header_footer">

        <div class="header">
        </div>


        <div class="article" t-att-data-oe-model="doc and doc._name" t-att-data-oe-id="doc and doc.id"
             t-att-data-oe-lang="doc and doc.env.context.get('lang')">
            <t t-raw="0"/>
        </div>


        <div class="footer">
        </div>

    </template>
</data>
</odoo>

Overlapping Example

谢谢

2 个答案:

答案 0 :(得分:1)

我设法通过增加和减少报告纸张格式的上边距和页眉间距来解决这个问题。

感谢这些链接和上述用户的帮助,我设法解决了这个问题。

   <record id="paperformat_report_quotation_models_contract" model="report.paperformat">
        <field name="name">European A4</field>
        <field name="default" eval="True"/>
        <field name="format">A4</field>
        <field name="page_height">0</field>
        <field name="page_width">0</field>
        <field name="orientation">Portrait</field>
        <field name="margin_top">52</field>
        <field name="margin_bottom">32</field>
        <field name="margin_left">0</field>
        <field name="margin_right">0</field>
        <field name="header_line" eval="False"/>
        <field name="header_spacing">40</field>
        <field name="dpi">90</field>
    </record>

Custom header overlaps with the body of the report.

Header overlaps the body of the report, table example.

Header is overlapping with the reports body, useful advice.

Header has overlapped the body of the report, another useful advice.

答案 1 :(得分:0)

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <template id="sample_id" inherit_id="module. id_name">
            <xpath expr="//div[@class='header']" position="replace">
            </xpath>
        </template>
    </data>
</odoo>