[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>
This commit is contained in:
Nicolas (vin)
2023-01-16 18:14:48 +01:00
parent 8e6e200477
commit cb9e936dc8
2 changed files with 55 additions and 31 deletions
+18
View File
@@ -50,12 +50,30 @@
<field name="binding_type">report</field>
</record>
<!-- The top margin on the default A4 format is way too big -->
<record id="paperformat_euro_bank_statement" model="report.paperformat">
<field name="name">A4 - statement</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">20</field>
<field name="margin_bottom">32</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">15</field>
<field name="dpi">90</field>
</record>
<record id="action_report_account_statement" model="ir.actions.report">
<field name="name">Statement</field>
<field name="model">account.bank.statement</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">account.report_statement</field>
<field name="report_file">account.report_statement</field>
<field name="paperformat_id" ref="account.paperformat_euro_bank_statement"/>
<field name="binding_model_id" ref="model_account_bank_statement"/>
<field name="binding_type">report</field>
</record>
+37 -31
View File
@@ -1,15 +1,28 @@
<?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="web.internal_layout">
<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-end w-100">
<h4 class="text-center w-100">
<strong>
<span t-if="o.journal_id.type == 'bank'">Bank Statement</span>
<span t-else="">Cash Statement</span>
@@ -21,26 +34,24 @@
<div class="pt-2 pb-2">
<div class="row">
<div class="col-12">
<div class="col-7">
<h5>
<strong>
<span t-field="o.journal_id"/>
<t t-if="o.journal_id.bank_account_id"> -
<span t-field="o.journal_id.bank_account_id"/>
<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"> -
<span t-field="o.journal_id.code"/>
<t t-if="o.journal_id.code">
- <t t-out="o.journal_id.code"/>
</t>
</strong>
</h5>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="col-5" style="text-align: end;">
<h5>
<strong>
<t t-if="o.name">
<span t-field="o.name"/>
<span t-field="o.name"/>
- </t>
<span t-field="o.date"/>
</strong>
@@ -92,24 +103,19 @@
<table class="table table-borderless m-0">
<tbody>
<tr t-foreach="o.line_ids" t-as="line" class="pb-2">
<td class="ps-0 pe-0">
<table class="table table-borderless">
<tr>
<td class="p-0 w-25">
<span class="d-block fw-bold" t-field="line.date"/>
</td>
<td class="p-0">
<span class="d-block fw-bold" t-if="line.partner_id" t-field="line.partner_id"/>
<span class="d-block" t-if="line.partner_bank_id" t-field="line.partner_bank_id"/>
<span class="d-block" t-if="line.payment_ref" t-field="line.payment_ref"/>
<span class="d-block" t-if=" not is_html_empty(line.narration)" t-field="line.narration"/>
</td>
<td class="text-end p-0">
<span class="d-block fw-bold" t-field="line.amount"/>
</td>
</tr>
</table>
<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>
@@ -120,4 +126,4 @@
</t>
</template>
</data>
</odoo>
</odoo>