<?xml version="1.0"?>
<document filename="test.pdf">
  <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
    <pageTemplate id="first">
      <frame id="first" x1="34.0" y1="28.0" width="527" height="786"/>
    </pageTemplate>
  </template>
  <stylesheet>
    <blockTableStyle id="Standard_Outline">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau2">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau6">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
      <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
      <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
      <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
      <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="5,0" stop="5,-1"/>
      <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
      <blockBackground colorName="#e6e6e6" start="0,0" stop="0,-1"/>
      <blockBackground colorName="#e6e6e6" start="1,0" stop="1,-1"/>
      <blockBackground colorName="#e6e6e6" start="2,0" stop="2,-1"/>
      <blockBackground colorName="#e6e6e6" start="3,0" stop="3,-1"/>
      <blockBackground colorName="#e6e6e6" start="4,0" stop="4,-1"/>
      <blockBackground colorName="#e6e6e6" start="5,0" stop="5,-1"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau7">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau8">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau3">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <blockBackground colorName="#e6e6e6" start="0,1" stop="0,-1"/>
      <blockBackground colorName="#e6e6e6" start="1,1" stop="1,-1"/>
      <blockBackground colorName="#e6e6e6" start="2,1" stop="2,-1"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau4">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <blockBackground colorName="#e6e6e6" start="0,0" stop="0,-1"/>
      <blockBackground colorName="#e6e6e6" start="1,0" stop="1,-1"/>
      <blockBackground colorName="#e6e6e6" start="2,0" stop="2,-1"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau5">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <initialize>
      <paraStyle name="all" alignment="justify"/>
    </initialize>
    <paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P2" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P3" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P5" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P6" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P7" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P8" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P9" fontName="Times-Italic" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P10" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P11" fontName="Times-Bold" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P12" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P13" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P14" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
    <paraStyle name="P15" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
    <paraStyle name="P16" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
    <paraStyle name="P17" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
    <paraStyle name="P18" fontName="Times-Roman" fontSize="11.0" leading="14"/>
    <paraStyle name="P19" fontName="Times-Roman" fontSize="11.0" leading="14"/>
    <paraStyle name="P20" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
    <paraStyle name="P21" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P22" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P23" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Standard" fontName="Times-Roman"/>
    <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
    <paraStyle name="Index" fontName="Times-Roman"/>
  </stylesheet>
  <images/>
  <story>
    <para style="P1">[[ repeatIn(objects,'o') ]]</para>
    <para style="P1">[[ setLang(o.partner_id.lang) ]]</para>
    <blockTable colWidths="295.0,232.0" style="Tableau2">
      <tr>
        <td>
          <para style="P2">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="Standard">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
          <para style="Standard">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
          <para style="Standard">[[ o.address_invoice_id.street ]]</para>
          <para style="Standard">[[ o.address_invoice_id.street2 or '' ]]</para>
          <para style="Standard">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
          <para style="Standard">[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]]</para>
          <para style="Standard">[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]]</para>
          <para style="Standard">
            <font color="white"> </font>
          </para>
          <para style="Standard">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
          <para style="Standard">Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]]</para>
          <para style="Standard">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
        </td>
      </tr>
    </blockTable>
    <para style="P14">
      <font color="white"> </font>
    </para>
    <para style="P17">Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
    <para style="P17">PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
    <para style="P17">Draft Invoice [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para>
    <para style="P17">Canceled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
    <para style="P17">Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
    <para style="P17">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
    <para style="P16">
      <font face="Times-Roman">Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]]</font>
      <font face="Times-Roman">[[ o.number ]]</font>
    </para>
    <para style="P15">
      <font color="white"> </font>
    </para>
    <para style="P18">
      <font face="Times-Roman">Document</font>
      <font face="Times-Roman">:</font>
      <font face="Times-Roman">[[o.name]]</font>
    </para>
    <para style="P18">
      <font face="Times-Roman">Invoice Date: </font>
      <font face="Times-Roman">[[o.date_invoice]]</font>
    </para>
    <para style="P19"><font face="Times-Roman">Partner Code:</font> [[ o.address_invoice_id.partner_id.ref or removeParentNode('para') ]]</para>
    <para style="Standard">
      <font color="white"> </font>
    </para>
    <blockTable colWidths="216.0,62.0,62.0,62.0,51.0,74.0" style="Tableau6">
      <tr>
        <td>
          <para style="P3">Description</para>
        </td>
        <td>
          <para style="P4">Taxes</para>
        </td>
        <td>
          <para style="P4">Quantity</para>
        </td>
        <td>
          <para style="P4">Unit Price</para>
        </td>
        <td>
          <para style="P4">Disc. (%)</para>
        </td>
        <td>
          <para style="P4">Price</para>
        </td>
      </tr>
    </blockTable>
    <section>
      <para style="P21">[[repeatIn(o.invoice_line,'l') ]]</para>
      <blockTable colWidths="216.0,62.0,62.0,62.0,51.0,74.0" style="Tableau7">
        <tr>
          <td>
            <para style="Table Contents">[[ l.name ]]</para>
          </td>
          <td>
            <para style="P6">[[ ', '.join([lt.name for lt in l.invoice_line_tax_id]) ]]</para>
          </td>
          <td>
            <para style="P8">[[ formatLang(l.quantity) ]] [[l.uos_id and l.uos_id.name or '' ]]</para>
          </td>
          <td>
            <para style="P8">[[ formatLang(l.price_unit) ]]</para>
          </td>
          <td>
            <para style="P8">[[ l.discount and formatLang (l.discount) or '' ]] </para>
          </td>
          <td>
            <para style="P8">[[ formatLang(l.price_subtotal) ]] [[o.currency_id.code ]]</para>
          </td>
        </tr>
      </blockTable>
      <blockTable colWidths="28.0,499.0" style="Tableau8">
        <tr>
          <td>
            <para style="P22">[[ repeatIn((l.note and l.note.splitlines()) or [], 'note') ]]</para>
          </td>
          <td>
            <para style="P9">[[ note or removeParentNode('table') ]]</para>
          </td>
        </tr>
      </blockTable>
    </section>
    <para style="Standard">
      <font color="white"> </font>
    </para>
    <blockTable colWidths="215.0,313.0" style="Tableau3">
      <tr>
        <td>
          <blockTable colWidths="81.0,73.0,60.0" style="Tableau4">
            <tr>
              <td>
                <para style="P10">Tax</para>
              </td>
              <td>
                <para style="P8">Base</para>
              </td>
              <td>
                <para style="P8">Amount</para>
              </td>
            </tr>
            <tr>
              <td>
                <para style="P5"><font face="Times-Roman">[[ repeatIn(o.tax_line,'t') ]]</font> [[ t.name ]]</para>
              </td>
              <td>
                <para style="P11">[[ formatLang(t.base) ]]</para>
              </td>
              <td>
                <para style="P11">[[ formatLang(t.amount)]]</para>
              </td>
            </tr>
          </blockTable>
        </td>
        <td>
          <blockTable colWidths="214.0,95.0" style="Tableau5">
            <tr>
              <td>
                <para style="P7">Total (excl. taxes):</para>
              </td>
              <td>
                <para style="P12">[[ formatLang(o.amount_untaxed) ]] [[o.currency_id.code ]]</para>
              </td>
            </tr>
            <tr>
              <td>
                <para style="P7">Taxes:</para>
              </td>
              <td>
                <para style="P12">[[ formatLang(o.amount_tax) ]] [[o.currency_id.code ]]</para>
              </td>
            </tr>
            <tr>
              <td>
                <para style="P13">Total <font face="Times-Roman">(incl. taxes):</font></para>
              </td>
              <td>
                <para style="P23">[[ formatLang(o.amount_total) ]] [[o.currency_id.code ]]</para>
              </td>
            </tr>
          </blockTable>
          <para style="Table Contents">
            <font color="white"> </font>
          </para>
        </td>
      </tr>
    </blockTable>
    <para style="P20">[[ format(o.comment or '') ]]</para>
    <para style="P20">
      <font color="white"> </font>
    </para>
    <para style="P20">[[ format((o.payment_term and o.payment_term.note) or '') ]]</para>
  </story>
</document>

