Files
odoo_source/addons/account/views/report_statement.xml
T
Nicolas (vin) cb9e936dc8 [IMP] account: bank statement report improvement
Improve the bank statement report by reducing the amount of
blank lines in it, as well as adding more information about
the partner and bank account when we have it.

Task id #2860753

closes odoo/odoo#93162

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2023-01-16 18:14:48 +01:00

130 lines
7.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- better support for long company name -->
<template id="report_statement_internal_layout" inherit_id="web.internal_layout" primary="True">
<xpath expr="//div[hasclass('col-3')]" position="attributes">
<attribute name="class">col-4</attribute>
</xpath>
<xpath expr="//div[hasclass('col-2') and hasclass('offset-2') and hasclass('text-center')]" position="attributes">
<attribute name="class">col-4 text-center</attribute>
</xpath>
<xpath expr="//div[hasclass('col-2') and hasclass('offset-3') and hasclass('text-end')]" position="attributes">
<attribute name="class">col-2 offset-2 text-end</attribute>
</xpath>
</template>
<template id="report_statement">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account.report_statement_internal_layout">
<div class="page">
<div class="border border-top-0 border-end-0 border-start-0 border-info">
<div class="row">
<div class="col-12">
<h4 class="text-center w-100">
<strong>
<span t-if="o.journal_id.type == 'bank'">Bank Statement</span>
<span t-else="">Cash Statement</span>
</strong>
</h4>
</div>
</div>
</div>
<div class="pt-2 pb-2">
<div class="row">
<div class="col-7">
<h5>
<strong>
<t t-out="o.journal_id.display_name"/>
<t t-if="o.journal_id.bank_account_id">
- <t t-out="o.journal_id.bank_account_id.display_name"/>
</t>
<t t-if="o.journal_id.code">
- <t t-out="o.journal_id.code"/>
</t>
</strong>
</h5>
</div>
<div class="col-5" style="text-align: end;">
<h5>
<strong>
<t t-if="o.name">
<span t-field="o.name"/>
- </t>
<span t-field="o.date"/>
</strong>
</h5>
</div>
</div>
</div>
<table class="table table-lg m-0 table-borderless border border-end-0 border-start-0 border-info">
<tbody>
<tr>
<td class="pt-2 pb-2 ps-0 pe-0">
<table class="table table-borderless m-0">
<tr>
<td class="p-0 w-25">
<strong>Starting Balance</strong>
</td>
<td class="p-0">
<strong>
<span t-out="o.line_ids and o.line_ids.sorted(lambda line: line.date)[0].date" t-options='{"widget": "date"}'/>
</strong>
</td>
<td class="text-end p-0">
<strong>
<span t-field="o.balance_start"/>
</strong>
</td>
</tr>
<tr>
<td class="p-0 w-25">
<strong>Ending Balance</strong>
</td>
<td class="p-0">
<strong>
<span t-out="o.line_ids and o.line_ids.sorted(lambda line: line.date)[-1].date" t-options='{"widget": "date"}'/>
</strong>
</td>
<td class="text-end p-0">
<strong>
<span t-field="o.balance_end_real"/>
</strong>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<table class="table table-borderless m-0">
<tbody>
<tr t-foreach="o.line_ids" t-as="line">
<td class="w-25 py-1">
<span class="d-block fw-bold" t-field="line.date"/>
</td>
<td class="py-1">
<span class="d-block fw-bold" t-if="line.partner_id">
<t t-out="line.partner_id.name"/> <t t-if="line.partner_bank_id and line.partner_bank_id.partner_id != line.partner_id">(<t t-out="line.partner_bank_id.partner_id.name"/>)</t>
</span>
<span class="d-block" t-if="line.partner_bank_id or line.account_number" t-out="line.account_number or line.partner_bank_id.acc_number"/>
<span class="d-block" t-if="line.payment_ref" t-field="line.payment_ref"/>
</td>
<td class="text-end py-1">
<span t-att-class="'d-block fw-bold' + (' text-danger' if line.amount &lt; 0 else '')" t-field="line.amount"/>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
</data>
</odoo>