<?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="42.0" width="527" height="758"/>
    </pageTemplate>
  </template>
  <stylesheet>
    <blockTableStyle id="Standard_Outline">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau1">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau2">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <lineStyle kind="GRID" colorName="black"/>
      <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
      <blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
      <blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
      <blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
      <blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
      <blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau3">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau5">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau6">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau4">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <initialize>
      <paraStyle name="all" alignment="justify"/>
    </initialize>
    <paraStyle name="P1" fontName="Times-Roman" fontSize="9.0" leading="11"/>
    <paraStyle name="P2" fontName="Times-Bold" fontSize="9.0" leading="11"/>
    <paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13"/>
    <paraStyle name="P4" fontName="Times-Roman" fontSize="10.0" leading="13"/>
    <paraStyle name="P5" fontName="Times-Roman" fontSize="4.0" leading="5"/>
    <paraStyle name="P6" fontName="Times-Bold" fontSize="9.0" leading="11"/>
    <paraStyle name="P7" fontName="Times-Roman" fontSize="11.0" leading="14"/>
    <paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14"/>
    <paraStyle name="P9" fontName="Times-Roman" fontSize="4.0" leading="5"/>
    <paraStyle name="P10" fontName="Times-Roman"/>
    <paraStyle name="P11" fontName="Times-Roman" fontSize="16.0" leading="20"/>
    <paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14"/>
    <paraStyle name="P13" fontName="Times-Bold" fontSize="8.0" leading="10"/>
    <paraStyle name="P14" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
    <paraStyle name="P15" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT"/>
    <paraStyle name="P16" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/>
    <paraStyle name="P17" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
    <paraStyle name="P18" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
    <paraStyle name="P19" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
    <paraStyle name="P20" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
    <paraStyle name="P21" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
    <paraStyle name="P22" fontName="Times-Roman" fontSize="7.0" leading="9"/>
    <paraStyle name="P23" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
    <paraStyle name="P24" fontName="Times-Roman" fontSize="7.0" leading="9"/>
    <paraStyle name="P25" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
    <paraStyle name="P26" fontName="Times-Bold" fontSize="9.0" leading="11"/>
    <paraStyle name="P27" fontName="Times-Roman" alignment="LEFT"/>
    <paraStyle name="P28" fontName="Times-Roman" alignment="LEFT"/>
    <paraStyle name="Standard" fontName="Times-Roman"/>
    <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
    <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Table Contents" fontName="Times-Roman"/>
    <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
    <paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
    <paraStyle name="Index" fontName="Times-Roman"/>
  </stylesheet>
  <story>
    <para style="P1">[[ repeatIn(objects,'o') ]] <font face="Times-Roman">[[ setLang(o.partner_id.lang) ]]</font></para>
    <blockTable colWidths="257.0,50.0,220.0" style="Tableau1">
      <tr>
        <td>
          <para style="P2">Shipping address :</para>
          <para style="P3">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
          <para style="P3">[[ o.partner_shipping_id.title or '' ]] [[ o.partner_shipping_id.name ]]</para>
          <para style="P3">[[ o.partner_shipping_id.street ]]</para>
          <para style="P3">[[ o.partner_shipping_id.street2 or '' ]]</para>
          <para style="P4"><font face="Times-Roman">[[ o.partner_shipping_id.zip or '' ]]</font> [[ o.partner_shipping_id.city or '' ]]</para>
          <para style="P4">[[ o.partner_shipping_id.state_id and o.partner_shipping_id.state_id.name or '' ]]</para>
          <para style="P4">[[ o.partner_shipping_id.country_id and o.partner_shipping_id.country_id.name or '' ]]</para>
          <para style="P5">
            <font color="white"> </font>
          </para>
          <para style="P6">Invoice address :</para>
          <para style="P4">[[ o.partner_invoice_id.street ]][[ o.partner_invoice_id.street2 and ', %s' % o.partner_invoice_id.street2 or '' ]]</para>
          <para style="P4">[[ o.partner_invoice_id.zip or '' ]] [[ o.partner_invoice_id.city or '' ]] [[ ', %s' % (o.partner_invoice_id.country_id and o.partner_invoice_id.country_id.name or '') ]]</para>
        </td>
        <td>
          <para style="P7">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="P8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
          <para style="P8">[[ o.partner_order_id.title or '' ]] [[ o.partner_order_id.name ]]</para>
          <para style="P8">[[ o.partner_order_id.street ]]</para>
          <para style="P8">[[ o.partner_order_id.street2 or '' ]]</para>
          <para style="P8">[[ o.partner_order_id.zip or '' ]] [[ o.partner_order_id.city or '' ]]</para>
          <para style="P8">[[ o.partner_order_id.state_id and o.partner_order_id.state_id.name or '' ]]</para>
          <para style="P8">[[ o.partner_order_id.country_id and o.partner_order_id.country_id.name or '' ]]</para>
          <para style="P9">
            <font color="white"> </font>
          </para>
          <para style="P3">Tel. : [[ o.partner_order_id.phone or '' ]]</para>
          <para style="P3">Fax : [[ o.partner_order_id.fax or '' ]]</para>
          <para style="P3">VAT : [[ o.partner_id.vat or '' ]]</para>
        </td>
      </tr>
    </blockTable>
    <para style="P10">
      <font color="white"> </font>
    </para>
    <para style="P11">[[ o.state=='draft' and 'Quotation ' or 'Order ' ]] N° : [[ o.name ]]</para>
    <para style="P11">
      <font color="white"> </font>
    </para>
    <para style="P12">Your order reference : [[ o.client_order_ref or '' ]]</para>
    <para style="P12">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para>
    <para style="P12">Our salesman : [[ o.user_id.name ]]</para>
    <para style="P10">
      <font color="white"> </font>
    </para>
    <blockTable colWidths="270.0,63.0,56.0,32.0,52.0,55.0" repeatRows="1" style="Tableau2">
      <tr>
        <td>
          <para style="P13">Product Description</para>
        </td>
        <td>
          <para style="P14">Applicable Taxes</para>
        </td>
        <td>
          <para style="P15">Qty</para>
        </td>
        <td>
          <para style="P13">Disc.</para>
        </td>
        <td>
          <para style="P13">Unit Price</para>
        </td>
        <td>
          <para style="P13">Net Price</para>
        </td>
      </tr>
    </blockTable>
    <section>
      <para style="P16">[[ repeatIn(o.order_line,'line') ]]</para>
      <blockTable colWidths="270.0,63.0,56.0,32.0,52.0,54.0" style="Tableau3">
        <tr>
          <td>
            <para style="P17">[[ line.name ]]</para>
          </td>
          <td>
            <para style="P18">[[ ', '.join(map(lambda x: x.name, line.tax_id))]]</para>
          </td>
          <td>
            <para style="P19">[[ line.product_uos_qty or line.product_uom_qty ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]]</para>
          </td>
          <td>
            <para style="P17">[[ (line.discount and str(line.discount)+'%')or '' ]]</para>
          </td>
          <td>
            <para style="P19">[[ '%.2f' % line.price_unit ]]</para>
          </td>
          <td>
            <para style="P19">[[ '%.2f' % line.price_subtotal ]]</para>
          </td>
        </tr>
      </blockTable>
      <blockTable colWidths="52.0,366.0,110.0" style="Tableau5">
        <tr>
          <td>
            <para style="P20">[[ repeatIn((line.notes and [line.notes]) or [], 'l') ]]</para>
          </td>
          <td>
            <para style="P21">[[ l ]] [[ setTag('para','xpre') ]]</para>
          </td>
          <td>
            <para style="P20">
              <font color="white"> </font>
            </para>
          </td>
        </tr>
      </blockTable>
    </section>
    <blockTable colWidths="349.0,69.0,110.0" style="Tableau6">
      <tr>
        <td>
          <para style="P22">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="P23">Net Total :</para>
        </td>
        <td>
          <para style="P23">[[ '%.2f' % o.amount_untaxed ]] [[ o.pricelist_id.currency_id.name ]]</para>
        </td>
      </tr>
      <tr>
        <td>
          <para style="P22">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="P23">Taxes :</para>
        </td>
        <td>
          <para style="P23">[[ '%.2f' % o.amount_tax ]] [[ o.pricelist_id.currency_id.name ]]</para>
        </td>
      </tr>
      <tr>
        <td>
          <para style="P24">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="P25">TOTAL :</para>
        </td>
        <td>
          <para style="P25">[[ '%.2f' % o.amount_total ]] [[ o.pricelist_id.currency_id.name ]]</para>
        </td>
      </tr>
    </blockTable>
    <para style="P26">
      <font color="white"> </font>
    </para>
    <blockTable colWidths="527.0" style="Tableau4">
      <tr>
        <td>
          <para style="P27">[[ o.note or '' ]] [[ setTag('para','xpre') ]]</para>
        </td>
      </tr>
      <tr>
        <td>
          <para style="P27">[[ 'xpre' and o.partner_id.property_payment_term and o.partner_id.property_payment_term[1] ]] [[ setTag('para','xpre') ]]</para>
        </td>
      </tr>
    </blockTable>
    <para style="P28">
      <font color="white"> </font>
    </para>
  </story>
</document>

