微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

我正在编写一些报告,但在页眉和页脚区域遇到了重叠问题。我阅读了一些关于这个主题的类似帖子(降级 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

谢谢

解决方法

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

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

   <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.

,
<?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>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。