KbiR
KbiR

Reputation: 4174

Customize report layout odoo 10

I customized external_layout_header to repeat vendor&shipping address in Purchase Order. Its success fully reflected. But problem is, the content in div class='page' overlap the the header. I gave margin-top:xx to class='page' but its not affected. How can i achieve this?

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

Sample report.

enter image description here

Upvotes: 0

Views: 1671

Answers (2)

Pranjal Gami
Pranjal Gami

Reputation: 214

Add this to your report file.

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

Adjust margin_top and header_spacing according to your need.

Upvotes: 0

CZoellner
CZoellner

Reputation: 14768

The header and footer "margins" are set in the documents paper format. So you have to either change the default paper format, which should be used for most of the reports in Odoo, or you create a new one and link it to purchase order report.

Upvotes: 1

Related Questions