2017-12-07 6 views
1

私はバーコードラベルを印刷するレポートを作成しています。Odooで製品バーコードラベルのみを印刷するには?どのように紙のデフォルトサイズを変更するには?

私のテンプレートはページ全体を印刷しようとしますが、私はスペシャページ側が必要です:width = 35mmheight = 11mm

どのようにデフォルトの製品ラベルレポートテンプレートを変更して変更できますか?私はpdfとしてラベルだけを印刷する必要があります。

+1

カスタムペーパーフォーマットを使用する必要があります。設定>レポート>用紙フォーマット – ChesuCR

+0

あなたは適切なレイアウトを使用する必要があります。 – ChesuCR

答えて

0

バーコード付きレポートテンプレートでは、この例ではqrcodeが使用されますが、ニーズに合わせて変更することができます。いくつかのスタイルを追加することもできます。

<template id="report_label_style" inherit_id="website_report.layout"> 
    <xpath expr="//style" position="after"> 
     <style type="text/css"> 
      .example_class { 
       display: block; 
       width: 228px; 
       height: 103px; 
      } 
     </style> 
    </xpath> 
</template> 

<template id="report_label"> 
    <t t-call="report.html_container"> 
     <t t-foreach="docs" t-as="o"> 
      <div class="page"> 
       <div class="row"> 
        <div class="example_class"> 
         <t t-set="qr_src">/report/barcode/?type=QR&amp;value=<t t-esc="o.qr_string" />&amp;width=600&amp;height=600</t> 
         <img t-att-src="'%s' % qr_src"/> 
        </div> 
       </div> 
      </div> 
     </t> 
    </t> 
</template> 

ペーパーフォーマット定義。あなたがに行く場合は、paperformatが表示されます。

はここ
<report id="action_report_label" 
     model="model.name" 
     report_type="qweb-pdf" 
     name="module_name.report_label" 
     file="module_name.report_label" 
     string="Label" /> 

私は関連付ける:設定>レポート>ペーパーフォーマ

<record id="paperformat_label_example" model="report.paperformat"> 
    <field name="name">Paperformat Example</field> 
    <field name="default" eval="True"/> 
    <field name="format">custom</field> 
    <field name="page_height">23</field> 
    <field name="page_width">50</field> 
    <field name="orientation">Portrait</field> 
    <field name="margin_top">0</field> 
    <field name="margin_bottom">0</field> 
    <field name="margin_left">0</field> 
    <field name="margin_right">0</field> 
    <field name="header_line" eval="False"/> 
    <field name="header_spacing">0</field> 
    <field name="dpi">80</field> 
</record> 

レポートアクション、これはモデルir_act_report_xmlに必要なレコードを作成しますペーパーフォーマット:

<record id="module_name.action_report_label" model="ir.actions.report.xml"> 
    <field name="paperformat_id" ref="module_name.paperformat_label_example"/> 
</record> 
関連する問題