2017-12-07 17 views
1

바코드 라벨을 인쇄하는 보고서를 작성하고 있습니다.Odoo에서 제품 바코드 레이블 만 인쇄하는 방법? 용지의 기본 크기를 변경하는 방법은 무엇입니까?

내 템플릿은 전체 페이지를 인쇄하려고 시도하지만, specia 페이지면이 필요합니다 : 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>