PDF 보고서

With Studio, you can edit existing PDF reports (e.g., invoices, quotations, etc.) or create new ones.

기본 레이아웃

보고서의 기본 레이아웃은 스튜디오 외부에서 관리합니다. 설정 으로 이동한 다음 회사 섹션에서 문서 레이아웃 설정 을 클릭합니다. 레이아웃 설정은 해당 회사 전용으로 모든 보고서에 적용됩니다.

여러 가지 설정이 보고서 레이아웃에 어떤 영향을 미치는지 오른쪽 보고서 미리보기에서 확인할 수 있으며, PDF 미리보기 다운로드 를 클릭하면 샘플 청구서 PDF를 다운로드할 수 있습니다.

다음과 같이 설정합니다.

  • 레이아웃: 네 가지 레이아웃을 사용할 수 있습니다.

    밝은색 보고서 레이아웃 샘플
  • Colors: Change the primary and secondary colors used to structure reports. The default colors are automatically generated based on the colors of the logo.

  • 레이아웃 배경: 다음 배경을 사용할 수 있습니다.

    • 빈칸: 표시되는 내용이 없습니다.

    • 기하학적: 기하학적 도형 이미지가 배경화면에 표시됩니다.

    • 사용자 지정: 사용자 지정 배경 이미지를 업로드합니다.

  • Company tagline: This is displayed in the header of external reports. You can add multiple lines of text.

  • Company details: These are displayed in the header of external reports. You can add multiple lines of text.

  • 용지 서식: 보고서의 기본 용지 크기를 지정합니다. A4 (21cm x 29.7cm), US 레터 (21.59cm x 27.54cm) 또는 QR 코드 페이지 중에서 선택할 수 있습니다. 이와 같이 스튜디오용지 서식 필드에 있는 개별 보고서에 대해서도 지정할 수 있습니다.

새 PDF 보고서 만들기

새 보고서를 모델에 대해 생성하려면 모델에 액세스한 후 스튜디오 토글 버튼을 클릭한 다음 보고서 를 클릭합니다. 새로 만들기 를 클릭하고 팝업 창이 열리면 보고서 유형을 선택합니다. 이 내용은 머리글과 바닥글에 표시되는 내용을 지정하는 데에만 사용됩니다.

보고서 생성이 완료되면 편집 을 시작할 수 있습니다.

PDF 보고서 편집

모델에 사용할 수 있는 보고서에 액세스하려면, 모델 (예: 판매주문서)에 액세스한 후 스튜디오 토글 버튼을 클릭한 다음 보고서 를 클릭합니다. 기존 보고서를 선택하여 열거나 새 보고서를 만듭니다.

또는 스튜디오를 열고 보고서` 를 클릭한 후 특정 보고서나 모델을 검색할 수도 있습니다.

중요

표준 보고서를 복제 한 후 복제한 버전에서 변경하는 것이 좋습니다. 보고서를 복제하려면 보고서의 오른쪽 상단에 마우스 포인터를 올려놓고 세로 줄임표 아이콘 ()을 클릭한 다음 복제 를 선택합니다.

PDF 보고서 복제하기

옵션

Once you’ve selected or created a report, you can use the options in the left part of the screen to:

  • Change the Report name. The new name is applied everywhere (in Studio, under the Print button, and in the PDF file name).

  • Modify the Paper format. If no value is selected, the format defined in the default layout is used.

  • 인쇄 메뉴에 표시: 인쇄 메뉴에 보고서를 추가하며 레코드에서 사용할 수 있습니다.

  • 첨부 파일에서 다시 로드: 보고서가 처음 생성될 때 레코드에 첨부 파일로 저장하고 이후에는 보고서의 원본 버전을 다시 로드합니다. 청구서에 법적으로 요구되는 사항이며 주로 이 경우에 사용됩니다.

  • Limit visibility to groups: to limit the availability of the PDF report to specific user groups.

  • 소스 편집: XML 파일 에서 직접 보고서를 수정할 수 있습니다.

  • Reset report: to discard all changes made to the report and reset it to its standard version.

  • 인쇄 미리보기: 보고서 미리보기를 생성한 후 다운로드합니다.

보고서 편집기

보고서 편집기를 통해 보고서의 서식과 내용을 수정할 수 있습니다.

  • You can Undo or Redo changes using the related buttons or the shortcuts CTRL Z and CTRL Y.

  • 변경 사항은 보고서를 종료하면 자동으로 저장되며 또는 저장 버튼을 눌러서 수동으로 저장할 수 있습니다.

  • You can reset the report to its standard version by clicking the Reset report button in the left part of the screen.

중요

보고서에 있는 머리글과 바닥글을 편집할 경우 표준 보고서 및 사용자 지정 보고서에 영향을 주게 됩니다.

조건부 블록

The dashed rectangles represent conditional blocks (if/else statements). These are used to show/hide content based on specific conditions. Click on the block to view the conditions.

블록에 적용되어 있는 조건을 확인합니다.

값을 선택하여 출력 내용을 미리 보기로 확인한 후 필요한 경우 수정할 수 있습니다.

다른 조건의 출력을 미리 봅니다.

참고

조건은 XML 에서만 편집할 수 있습니다.

기타 콘텐츠

보고서에는 두 가지 유형의 텍스트 콘텐츠가 있습니다.

  • Static text, i.e., the text that’s not highlighted in blue, which can be modified directly in the editor.

  • 동적 텍스트는 파란색으로 강조 표시된 텍스트로, 보고서가 생성될 때 필드에 있는 값으로 대체됩니다(예: SO 번호 또는 견적 날짜).

명령어를 사용하여 보고서에 콘텐츠 (예: 필드, 목록, 테이블, 이미지, 배너 등)를 추가할 수 있습니다. / 를 입력하여 파워박스 가 열리고, 여기에서 명령어 제목을 입력하거나 목록에서 선택합니다.

보고서에 정적 텍스트를 추가하려면, 추가하려는 위치에 텍스트를 입력합니다.

고급 변경 사항의 경우 직접 XML에서 보고서 편집 을 할 수 있습니다.

필드 추가

필드를 추가하려면 / 를 입력한 후 필드 명령어를 선택합니다. 목록이 열리면 필드를 선택하거나 검색합니다. 필요한 경우 필드명 옆에 있는 오른쪽 화살표를 클릭하면 필드 목록에 액세스할 수 있습니다. 그런 다음 기본값을 지정하고 ‘엔터’ 를 누릅니다.

관련 필드를 선택하십시오.
데이터 테이블 추가하기

데이터 표는 관계형 항목 을 나타낼 때 사용합니다. 데이터 표를 추가하려면 / 를 입력하고 동적 표 명령을 선택한 다음 표에 표시할 관계를 선택합니다.

참고

관계 유형이 일대다 또는 다대다 인 경우에만 데이터 테이블로 표시할 수 있습니다.

표가 추가되면 표 도구를 사용하여 열을 추가할 수 있습니다. 열 상단에 커서를 놓은 다음 보라색 사각형을 클릭하고 항목을 선택합니다.

동적 테이블에 열을 추가합니다.

그런 다음 필드 를 열에 삽입할 수 있습니다. 대화 상자가 열리면 필드의 소스 개체 (예: 태그 모델) 및 사용할 수 있는 필드 목록이 표시됩니다.

태그 모델에 사용 가능한 필드 목록

참고

  • 기본 행으로 필드의 내용이 자동으로 반복되어 각 필드 값이 보고서에서 행으로 생성됩니다 (예: 태그당 행 하나로 생성). 표 도구를 사용하여 생성된 행 위 또는 아래에 정적 콘텐츠 행을 추가할 수 있습니다.

  • 또한 데이터 테이블을 추가할 수 있으며 보고서 XML를 수정합니다.

서식 지정

To format text in the report, select it, then format it using the options in the 텍스트 편집기.

텍스트 편집기로 텍스트 서식을 지정합니다.

보고서 XML 편집하기

경고

XML을 직접 수정할 경우 업그레이드 중에 보고서 문제가 발생할 수 있습니다. 이런 경우에는, 이전 데이터베이스에서 변경된 내용을 업그레이드된 데이터베이스로 복사만 하면 됩니다.

보고서에서 XML을 편집하려면 왼쪽 창에 있는 소스 편집 을 클릭합니다.

예시

복잡한 구조로 인해 표 자체가 제대로 인식되지 않는 경우도 있습니다. 이러한 경우에도 XML 보고서에서 직접 수정할 수 있습니다. 예를 들어 판매주문서의 경우 XML에서 다음과 같은 구조를 찾을 수 있습니다 (문서화 목적으로 단순화됨).

<!-- table root element -->
<table>
    <!-- thead = table header, the row with column titles -->
    <thead>
        <!-- table row element -->
        <tr>
            <!-- table header element -->
            <th>Name</th>
            <th>Price</th>
        </tr>
    </thead>
    <!-- table body, the main content -->
    <tbody>
        <!-- we create a row for each subrecord with t-foreach -->
        <tr t-foreach="record.some_relation_ids" t-as="line">
            <!-- for each line, we output the name and price as table cells -->
            <td t-out="line.name"/>
            <td t-out="line.price"/>
        </tr>
    </tbody>
</table>

테이블을 편집하려면 각 행에 데이터 셀의 수가 동일한지 확인해야 합니다. 예를 들어, 위의 경우 헤더 섹션 (예: 열 제목)에 셀을 추가하고 본문 섹션에 필드 콘텐츠 (일반적으로 t-out 또는 t-field 지시문을 사용)를 추가해야 합니다.

<table> <!-- table root element -->
    <thead> <!-- thead = table header, the row with column titles -->
        <tr> <!-- table row element -->
            <th>Name</th> <!-- table header element -->
            <th>Price</th>
            <th>Category</th>
        </tr>
    </thead>
    <tbody>  <!-- table body, the main content -->
        <tr t-foreach="record.some_relation_ids" t-as="line">  <!-- we create a row for each subrecord with t-foreach -->
            <td t-out="line.name"/>  <!-- for each line, we output the name and price as table cells -->
            <td t-out="line.price"/>
            <td t-out="line.category_id.display_name"/>
        </tr>
    </tbody>
</table>

참고

Cells can span multiple rows or columns. For more information, go to the Mozilla Developer Network website.

For example, you can modify the Quotation/Order report to add a column to display the product category in the main table:

<table class="table table-sm o_main_table table-borderless mt-4">
    <!-- In case we want to repeat the header, remove "display: table-row-group" -->
    <thead style="display: table-row-group">
        <tr>
            <th name="th_description" class="text-start">Description</th>
            <th>Product Category</th>
            <th name="th_quantity" class="text-end">Quantity</th>
            <th name="th_priceunit" class="text-end">Unit Price</th>
[...]
            <tr t-att-class="'bg-200 fw-bold o_line_section' if line.display_type == 'line_section' else 'fst-italic o_line_note' if line.display_type == 'line_note' else ''">
                <t t-if="not line.display_type">
                    <td name="td_name"><span t-field="line.name">Bacon Burger</span></td>
                    <td t-out="line.product_id.categ_id.display_name"/>
                    <td name="td_quantity" class="text-end">
                        <span t-field="line.product_uom_qty">3</span>
                        <span t-field="line.product_uom">units</span>
                        <span t-if="line.product_packaging_id">
판매주문서에 품목 카테고리 열을 추가합니다.

XML 형식으로 표를 추가하려면 액세스 및 표시하려는 필드와 개체의 이름을 알아야 합니다. 예를 들어, 판매주문서의 태그에 대해 자세히 설명하는 표를 추가해 보겠습니다.

<!-- table root element -->
<table class="table">
    <!-- thead = table header, the row with column titles -->
    <thead>
        <!-- table row element -->
        <tr>
            <!-- table header element -->
            <th>ID</th>
            <th>Name</th>
        </tr>
    </thead>
    <!-- table body, the main content -->
    <tbody>
        <!-- we create a row for each subrecord with t-foreach -->
        <tr t-foreach="doc.tag_ids" t-as="tag">
            <!-- for each line, we output the name and price as table cells -->
            <td t-out="tag.id"/>
            <td t-out="tag.name"/>
        </tr>
    </tbody>
</table>
XML로 데이터 테이블을 추가합니다.

참고

When adding tables manually, style them using Bootstrap classes, like the table class included in the example above.

If you want to show/hide content based on specific conditions, you can manually add if/else control statements in the report XML.

예를 들어 태그가 없는 경우 사용자 지정 데이터 표를 숨기려면 ‘t-if’ 속성을 사용하여 조건을 정의한 다음 ‘참’ 이나 ‘거짓’ 으로 평가할 수 있습니다. 따옴표 안에 태그가 없는 경우에는 표가 표시되지 않습니다.

<!-- table root element -->
<table class="table" t-if="len(doc.tag_ids) > 0">
    <!-- thead = table header, the row with column titles -->
    <thead>
        <!-- table row element -->
        <tr>
            <!-- table header element -->
            <th>ID</th>
            <th>Name</th>
        </tr>
    </thead>
    <!-- table body, the main content -->
    <tbody>
        <!-- we create a row for each subrecord with t-foreach -->
        <tr t-foreach="doc.tag_ids" t-as="tag">
            <!-- for each line, we output the name and price as table cells -->
            <td t-out="tag.id"/>
            <td t-out="tag.name"/>
        </tr>
    </tbody>
</table>

t-if 구문이 거짓 인 경우 다른 블록을 표시하려면 t-else 구문을 사용하여 지정할 수 있습니다. t-else 블록은 문서 구조에서 t-if 블록 바로 뒤에 위치해야 합니다. t-else 속성에 조건을 지정할 필요는 없습니다. 예를 들어 다음에서 견적서에 태그가 없음을 설명하는 간단한 메세지를 표시해 봅니다.

<!-- table root element -->
<table class="table" t-if="len(doc.tag_ids) > 0">
    <!-- thead = table header, the row with column titles -->
    <thead>
        <!-- table row element -->
        <tr>
            <!-- table header element -->
            <th>ID</th>
            <th>Name</th>
        </tr>
    </thead>
    <!-- table body, the main content -->
    <tbody>
        <!-- we create a row for each subrecord with t-foreach -->
        <tr t-foreach="doc.tag_ids" t-as="tag">
            <!-- for each line, we output the name and price as table cells -->
            <td t-out="tag.id"/>
            <td t-out="tag.name"/>
        </tr>
    </tbody>
</table>
<div class="text-muted" t-else="">No tag present on this document.</div>

By using the t-if/t-else notation, the report editor recognizes that these sections are mutually exclusive and should be displayed as conditional blocks:

태그가 있는 경우의 출력 미리보기입니다.

편집기로 조건을 전환하여 출력 화면을 미리 볼 수 있습니다.

태그가 없는 경우의 출력 미리보기입니다.

여러 가지 항목을 선택하려면 ‘t-elif’ 지시문을 사용하여 중간 조건을 추가할 수도 있습니다. 예를 들어 판매주문서 보고서의 제목은 기본 문서의 상태에 따라 변경되는 방식입니다.

<h2 class="mt-4">
    <span t-if="env.context.get('proforma', False) or is_pro_forma">Pro-Forma Invoice # </span>
    <span t-elif="doc.state in ['draft','sent']">Quotation # </span>
    <span t-else="">Order # </span>
    <span t-field="doc.name">SO0000</span>
</h2>

견적용 청구서 라는 제목은 일부 상황에서 사용하게 됩니다. 이러한 조건이 충족되지 않은 상태에서 문서 상태가 ‘초안’ 또는 ‘전송됨’인 경우에는 견적서 를 사용합니다. 이러한 조건 중 어느 것도 충족되지 않는 경우 보고서 제목은 주문서 가 됩니다.

보고서에서 이미지 작업을 하기란 쉽지 않습니다. 항상 명확하게 이미지 크기와 동작이 정교하게 제어되지 않기 때문입니다. 보고서 편집기 를 사용하여 이미지 필드를 삽입할 수 있지만 (/Field 명령어 사용), t-field 지시문과 함께 제공되는 t-options 속성을 사용하여 XML에 삽입하면 크기와 위치를 더욱 쉽게 제어할 수 있습니다.

예를 들어, 다음의 코드를 통해 해당 줄에 있는 품목의 image_128 필드가 64px 너비의 이미지로 출력됩니다(이미지의 가로세로 비율에 따라 높이가 자동 조정).

<span t-field="line.product_id.image_128" t-options-widget="image" t-options-width="64px"/>

다음 옵션을 이미지 위젯에 사용할 수 있습니다.

  • width: width of the image, usually in pixels or CSS length units (e.g., rem) (leave empty for auto-width).

  • height: height of the image, usually in pixels or CSS length units (e.g., rem) (leave empty for auto-height).

  • class: img 태그에 적용된 CSS 클래스입니다; 부트스트랩 클래스 를 사용할 수 있습니다.

  • alt: 이미지의 대체 텍스트

  • 스타일: 스타일 속성입니다. 더욱 자유롭게 스타일을 다시 지정하려면 Bootstrap 클래스 <https://getbootstrap.com/docs/5.1/content/tables> 를 확인해 보세요.

These attributes must contain strings, i.e., text enclosed within quotes within quotes, e.g., t-options-width="'64px'" (or, alternatively, a valid Python expression).

참고

이미지 위젯은 img 태그에 사용할 수 없습니다. 대신 span`(인라인 콘텐츠의 경우) 또는 `div`(블록 콘텐츠의 경우) 노드에 `t-field 지시문을 설정하세요.

예시로는 견적 표에 품목 이미지 열을 추가해 보겠습니다.

<table class="table table-sm o_main_table table-borderless mt-4">
    <thead style="display: table-row-group">
        <tr>
            <th>Image</th>
            <th name="th_description" class="text-start">Description</th>
            <th>Product Category</th>
            <th name="th_quantity" class="text-end">Quantity</th>
            <th name="th_priceunit" class="text-end">Unit Price</th>
[...]
        <t t-foreach="lines_to_report" t-as="line">
            <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal"/>
            <tr t-att-class="'bg-200 fw-bold o_line_section' if line.display_type == 'line_section' else 'fst-italic o_line_note' if line.display_type == 'line_note' else ''">
                <t t-if="not line.display_type">
                   <td>
                       <span t-field="line.product_template_id.image_128"
                             t-options-widget="'image'"
                             t-options-width="'64px'"
                             t-options-class="'rounded-3 shadow img-thumbnail'"
                           />
                   </td>
                    <td name="td_name"><span t-field="line.name">Bacon Burger</span></td>
                    <td t-out="line.product_id.categ_id.display_name"/>

t-options-width 속성으로 이미지 너비를 64픽셀로 제한하고, t-options-class 에서 사용되는 Bootstrap 클래스로는 모서리가 둥글고 그림자가 있는 썸네일같은 테두리를 만듭니다.

견적서 표에 이미지 열을 추가합니다.