从account.invoice.line模型打印所有行

时间:2015-08-11 09:34:59

标签: openerp odoo qweb

我创建了一个新的打印模板,我想自定义它,以便打印来自account.invoice.line模型的所有行。有没有办法可以做到这一点。到目前为止,这是模板的代码。

<t t-name="account.specifikacioni_report_document">
  <t t-call="report.external_layout">
    <div class="page">
      <table class="table table-condensed">
        <thead>
          <tr>
            <th>Description</th>
            <th>Quantity</th>
            <th class="text-right">Unit Price</th>
            <th class="text-right" groups="sale.group_discount_per_so_line">Discount (%)</th>
            <th class="text-right">Taxes</th>
            <th class="text-right">Amount</th>
          </tr>
        </thead>
        <tbody class="invoice_tbody">
          <tr t-foreach="o.invoice_line" t-as="l">
            <td>
              <span t-field="l.name"/>
            </td>
            <td>
              <span t-field="l.quantity"/>
              <span t-field="l.uos_id" groups="product.group_uom"/>
            </td>
            <td class="text-right">
              <span t-field="l.price_unit"/>
            </td>
            <td class="text-right" groups="sale.group_discount_per_so_line">
              <span t-field="l.discount"/>
            </td>
            <td class="text-right">
              <span t-esc="', '.join(map(lambda x: x.name, l.invoice_line_tax_id))"/>
            </td>
            <td class="text-right">
              <span t-field="l.price_subtotal" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </t>
</t>

这会打印一张发票的发票行,因为我复制了account.report_invoice_document并进行了编辑,但如何在此列出所有发票行,而不仅仅是发票的发票行

1 个答案:

答案 0 :(得分:0)

您可以按照report_invoice.xml打印行。

<table class="table table-condensed">
            <thead>
                <tr>
                    <th>Description</th>
                    <th>Quantity</th>
                    <th class="text-right">Unit Price</th>
                    <th class="text-right" groups="sale.group_discount_per_so_line">Discount (%)</th>
                    <th class="text-right">Taxes</th>
                    <th class="text-right">Amount</th>
                </tr>
            </thead>
            <tbody class="invoice_tbody">
                <tr t-foreach="o.invoice_line" t-as="l">
                    <td><span t-field="l.name"/></td>
                    <td>
                        <span t-field="l.quantity"/>
                        <span t-field="l.uos_id"  groups="product.group_uom"/>
                    </td>
                    <td class="text-right">
                        <span t-field="l.price_unit"/>
                    </td>
                    <td class="text-right" groups="sale.group_discount_per_so_line"><span t-field="l.discount"/></td>
                    <td class="text-right">
                        <span t-esc="', '.join(map(lambda x: x.name, l.invoice_line_tax_id))"/>
                    </td>
                    <td class="text-right">
                        <span t-field="l.price_subtotal" 
                            t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
                    </td>
                </tr>
            </tbody>
        </table>