<odoo>
    <template id="template_order_prepaid_invoice">
        <t t-call="web.basic_layout">
            <t t-set="print_with_payments" t-value="True"/>
            <t t-foreach="docs" t-as="o">
                <t t-call="l10n_ru_advance_payments.template_order_prepaid_invoice_body"/>
            </t>
        </t>
    </template>

    <template id="template_order_prepaid_invoice_body">
            <span>
                <t t-esc="address"/>
            </span>

            <div class="mt-5 clearfix">
                <div class="page mb-4">
                    <h2>
                        <span>Счет</span>
                        <span t-if="o.name != '/'" t-field="o.name">INV/2023/0001</span>
                        <span>
                            <t t-esc="address"/>
                        </span>
                    </h2>
                    <div class="oe_structure"/>
                    <div id="informations" class="row mt-3 mb-1">
                        <table class="table table-sm o_main_table table-borderless">
                            <tr>
                                <td style="width: 60%;">
                                    <strong>Выдано:</strong>
                                    <br/>
                                    <span t-field="o.partner_id.name"/>
                                    <br/>
                                    <span t-field="o.partner_id.street"/>
                                </td>
                                <td style="width: 10%;"/>
                                <td style="width: 15%;">
                                    <strong>Дата счета:</strong>
                                    <br/>
                                    <strong>Срок оплаты:</strong>
                                </td>
                                <td style="width: 15%;">
                                    <span>
                                        <t t-esc="o.invoice_date.strftime('%d.%m.%Y') or ''"/>
                                    </span>
                                    <br/>
                                    <span>
                                        <t t-esc="o.invoice_date_due.strftime('%d.%m.%Y') or ''"/>
                                    </span>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="oe_structure"/>
                    <style>
                        .main {font-weight:bold}
                        .new_class {text-align: left;}
                    </style>
                    <br/>
                    <table class="table table-sm o_main_table table-borderless" name="invoice_line_table">
                        <thead>
                            <tr>
                                <th name="th_description" class="text-start">
                                    <span>Описание</span>
                                </th>
                                <th name="th_quantity" class="text-end">
                                    <span>Количество</span>
                                </th>
                                <th name="th_priceunit"
                                    t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
                                    <span>Цена за ед.изм.</span>
                                </th>
                                <th name="th_taxes" t-if="o.th_field_taxes"
                                    t-attf-class="text-start {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
                                    <span>Налог</span>
                                </th>
                                <th name="th_subtotal" class="text-end">
                                    <span>Сумма</span>
                                </th>
                            </tr>
                        </thead>
                        <tbody class="invoice_tbody">
                            <t t-set="current_subtotal" t-value="0"/>
                            <t t-set="current_total" t-value="0"/>
                            <t t-set="lines" t-value="o.prepaid_line"/>

                            <t t-foreach="lines" t-as="line">
                                <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal"/>
                                <t t-set="current_total" t-value="current_total + line.price_total"/>
                                <tr>
                                    <td name="account_invoice_line_name">
                                        <t t-if="line.label">
                                        <span t-if="line.product_id"
                                              t-field="line.product_id.name"
                                              t-options="{'widget': 'text'}">
                                            Bacon Burger
                                        </span><span> / </span><span t-field="line.label" t-options="{'widget': 'text'}"/>
                                        </t>
                                        <t t-else="">
                                            <span t-if="line.product_id"
                                              t-field="line.product_id.name"
                                              t-options="{'widget': 'text'}">
                                            Bacon Burger
                                        </span>
                                        </t>
                                    </td>
                                    <td name="td_quantity" class="text-end">
                                        <span t-field="line.quantity">3.00</span>
                                        <span t-field="line.product_uom_id" groups="uom.group_uom">units</span>
                                    </td>
                                    <td name="td_price_unit"
                                        t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
                                        <span>
                                            <t t-esc="line.price_unit"/>
                                        </span>
                                    </td>
                                    <t t-if="o.th_field_taxes">
                                        <t t-set="taxes"
                                           t-value="', '.join([(tax.invoice_label or tax.name) for tax in line.tax_ids])"/>
                                        <td name="td_taxes"
                                            t-attf-class="text-start {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }} {{ 'text-nowrap' if len(taxes) &lt; 10 else '' }}">
                                            <span t-out="taxes" id="line_tax_ids">Tax 15%</span>
                                        </td>
                                    </t>
                                    <td name="td_subtotal" class="text-end o_price_total">
                                        <span class="text-nowrap" t-field="line.price_subtotal">27.00</span>
                                    </td>
                                </tr>

                                <t t-if="current_section and (line_last or lines[line_index+1].display_type == 'line_section')">
                                    <tr class="is-subtotal text-end">
                                        <td colspan="99">
                                            <strong class="mr16">Подытог</strong>
                                            <span t-out="current_subtotal"
                                                  t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}">
                                                31.05
                                            </span>
                                        </td>
                                    </tr>
                                </t>
                            </t>
                        </tbody>
                    </table>
                    <div>
                        <div id="right-elements"
                             t-attf-class="#{'col-5' if report_type != 'html' else 'col-12 col-md-5'} ms-5 d-inline-block float-end">
                            <div id="total" class="clearfix row">
                                <div class="ms-auto">
                                    <table class="table table-sm table-borderless avoid-page-break-inside">
                                        <tr class="border-black o_total">
                                            <td>
                                                <strong>Всего</strong>
                                            </td>
                                            <td class="text-end">
                                                <span class="text-nowrap" t-field="o.amount_sum_line">27.00</span>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div style="width: 100%; height: 20px;"/>
                        <br/>
                        <br/>
                        <br/>
                        <p>
                            <div style="page-break-inside: avoid;align-self: flex-start; margin-top: 20px;">
                                <p style="font-weight:bold">Информация</p>
                                <div>Номер:
                                    <span style="font-weight:bold">
                                        <t t-esc="o.name"/>
                                    </span>
                                </div>

                                <t t-if="o.comment">
                                    <div class="text-muted mb-3"
                                         t-attf-style="#{'text-align:justify;text-justify:inter-word;' if o.company_id.terms_type != 'html' else ''}"
                                         t-if="not is_html_empty(o.comment)" name="comment">
                                        <span t-field="o.comment"/>
                                    </div>
                                </t>
                                <t t-else="">

                                    <br/>
                                </t>
                                <br/>
                                <table class="table-borderless">
                                    <tr style="font-size:13px">
                                        <td>
                                            <span style="font-weight:bold">Бенефициар:</span>
                                        </td>
                                        <td>
                                            <td style="width: 25px;"/>
                                        </td>
                                        <td>
                                            <span>
                                                <t t-esc="o.company_id.name"/>
                                            </span>
                                        </td>
                                    </tr>
                                    <tr style="font-size:13px">
                                        <td>
                                            <span style="font-weight:bold">Адрес бенефициара:</span>
                                        </td>
                                        <td>
                                            <td style="width: 25px;"/>
                                        </td>
                                        <td>
                                            <span t-field="o.company_id.partner_id.street"/>
                                        </td>
                                    </tr>
                                    <tr style="font-size:13px">
                                        <td>
                                            <span style="font-weight:bold">ИНН:</span>
                                        </td>
                                        <td>
                                            <td style="width: 25px;"/>
                                        </td>
                                        <td>
                                            <span>
                                                <t t-esc="o.company_id.partner_id.vat"/>
                                            </span>
                                            <span t-field="o.company_id.partner_id.vat"/>
                                        </td>
                                    </tr>
                                    <tr style="font-size:13px">
                                        <td>
                                            <span style="font-weight:bold">Банк:</span>
                                        </td>
                                        <td>
                                            <td style="width: 25px;"/>
                                        </td>
                                        <td>
                                            <span>
                                                <t t-esc="o.partner_bank_id.bank_id.name"/>
                                            </span>
                                        </td>
                                    </tr>
                                    <tr style="font-size:13px">
                                        <td>
                                            <span style="font-weight:bold">Адрес банка:</span>
                                        </td>
                                        <td>
                                            <td style="width: 25px;"/>
                                        </td>
                                        <td>
                                            <span>
                                                <t t-esc="o.partner_bank_id.bank_id.street"/>
                                            </span>
                                        </td>
                                    </tr>
                                    <tr style="font-size:13px">
                                        <td>
                                            <span style="font-weight:bold">БИК:</span>
                                        </td>
                                        <td>
                                            <td style="width: 25px;"/>
                                        </td>
                                        <td>
                                            <span>
                                                <t t-esc="o.partner_bank_id.bank_id.bic"/>
                                            </span>
                                        </td>
                                    </tr>
                                    <tr style="font-size:13px">
                                        <td>
                                            <span style="font-weight:bold">Номер счета/IBAN:</span>
                                        </td>
                                        <td>
                                            <td style="width: 25px;"/>
                                        </td>
                                        <td>
                                            <span>
                                                <t t-esc="o.partner_bank_id.acc_number"/>
                                            </span>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </p>
                    </div>
                </div>
            </div>
    </template>
</odoo>

