自定义报告布局odoo 10

时间:2018-01-31 08:21:24

标签: odoo odoo-10

我自定义了external_layout_header以在vendor中重复shipping address& Purchase Order。它的成功充分体现了。但问题是,div class='page'中的内容与标题重叠。我将margin-top:xx提供给class='page',但不受影响。我怎样才能做到这一点?

* external_layout_inherit.xml

<template id="purchase_extrenal_layout" inherit_id="report.external_layout_header">
     <xpath expr="//div[@class='row zero_min_height']" position="before">
     <div class="row zero_min_height">
       <div class="col-xs-12">
        <div style="border-bottom: 1px solid black;"></div>
       </div>
     </div>
<div class="row">

      <div class="" style="float:left; text-align:left; margin-left:50px;">
        <strong>Customer address:</strong>
          <div t-field="o.partner_id"
              t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/>
              <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
      </div>
      <div style="float:right; text-align:right; margin-right:50px;">
        <strong>Shipping address:</strong>
        <div t-if="o.dest_address_id">
            <div t-field="o.dest_address_id"
                t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'/>
        </div>

        <div t-if="not o.dest_address_id and o.picking_type_id and o.picking_type_id.default_location_dest_id">
            <span t-field="o.picking_type_id.default_location_dest_id.partner_id.name"/>
            <div t-field="o.picking_type_id.default_location_dest_id.partner_id"
                t-options='{"widget": "contact", "fields": ["address", "phone", "fax"], "no_marker": True, "phone_icons": True}'/>
        </div>
      </div>
</div>

示例报告。

enter image description here

2 个答案:

答案 0 :(得分:1)

页眉和页脚&#34;页边距&#34;以文件纸张格式设置。因此,您必须更改默认纸张格式,该格式应该用于Odoo中的大多数报表,或者您创建一个新格式并将其链接到采购订单报告。

答案 1 :(得分:0)

将其添加到您的报告文件中。

<record id="paperformat_rfq" model="report.paperformat">
    <field name="name">A4 Barcode Paper</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">8</field>
    <field name="margin_bottom">0</field>
    <field name="margin_left">3</field>
    <field name="margin_right">0</field>
    <field name="header_line" eval="False"/>
    <field name="header_spacing">5</field>
    <field name="dpi">90</field>
</record>

<record id="action_request_quotation" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="your_module_name.paperformat_rfq"/>
</record>

根据需要调整margin_top和header_spacing。