[IMP] partner_statement: add Detailed Activity report

This commit is contained in:
Miquel Raïch
2022-12-16 10:29:17 +01:00
parent c18ab91075
commit b9b4f1e67f
22 changed files with 1537 additions and 345 deletions

View File

@@ -2,6 +2,119 @@
<!-- Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="activity_balance">
<p>
<span t-if="is_detailed">Detailed </span>
<span
t-if="account_type == 'payable'"
>Supplier </span>Statement between <span t-esc="d['start']" /> and <span
t-esc="d['end']"
/> in <span t-esc="display_currency.name" />
</p>
<table class="table table-condensed table-statement">
<thead>
<tr>
<th>Reference number</th>
<th>Date</th>
<th>Description</th>
<th class="amount">Original Amount</th>
<th class="amount">Applied Amount</th>
<th class="amount">Open Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td />
<td>
<span t-esc="d['prior_day']" />
</td>
<td t-if="is_detailed">Initial Balance</td>
<td t-else="">Balance Forward</td>
<td />
<td />
<td class="amount">
<span
t-esc="currency['balance_forward']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
<tr
t-foreach="currency['lines']"
t-as="line"
t-att-class="('statement-blocked ' if line['blocked'] else '') + ('statement-reconciled' if line['reconciled_line'] else '')"
>
<td>
<span
t-if="line['reconciled_line']"
style="padding-left: 11px;"
/><span t-esc="line['move_id']" />
</td>
<td>
<span t-esc="line['date']" />
</td>
<td>
<t t-if="line['name'] != '/'">
<t t-if="not line['ref'] and line['name']">
<span t-esc="line['name']" />
</t>
<t t-if="line['ref'] and not line['name']">
<span t-esc="line['ref']" />
</t>
<t t-if="line['ref'] and line['name']">
<t
t-if="line['name'] not in line['ref'] or line['name'] == line['ref']"
>
<span t-esc="line['name']" />
</t>
<t t-if="line['ref'] not in line['name']">
<span t-esc="line['ref']" />
</t>
</t>
</t>
<t t-if="line['name'] == '/'">
<span t-esc="line['ref']" />
</t>
</td>
<td class="amount">
<span
t-esc="line['amount']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
t-if="not line['reconciled_line']"
/>
</td>
<td class="amount">
<span
t-esc="line['applied_amount']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
<td class="amount">
<span
t-esc="line['open_amount']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
t-if="not line['reconciled_line']"
/>
</td>
</tr>
<tr>
<td />
<td>
<span t-esc="d['end']" />
</td>
<td>Ending Balance</td>
<td />
<td />
<td class="amount">
<span
t-esc="currency['amount_due']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
</tbody>
</table>
</template>
<template id="partner_statement.activity_statement_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang': lang})" />
@@ -35,109 +148,10 @@
<t t-foreach="d['currencies'].items()" t-as="currency">
<t t-set="display_currency" t-value="Currencies[currency[0]]" />
<t t-set="currency" t-value="currency[1]" />
<p>
<span
t-if="account_type == 'payable'"
>Supplier </span>Statement between <span
t-esc="d['start']"
/> and <span t-esc="d['end']" /> in <span
t-esc="display_currency.name"
/>
</p>
<table class="table table-condensed table-statement">
<thead>
<tr>
<th>Reference number</th>
<th>Date</th>
<th>Description</th>
<th class="amount">Amount</th>
<th class="amount">Balance</th>
</tr>
</thead>
<tbody>
<tr>
<td />
<td>
<span t-esc="d['start']" />
</td>
<td>
Balance Forward
</td>
<td />
<td class="amount">
<span
t-esc="currency['balance_forward']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
<tr
t-foreach="currency['lines']"
t-as="line"
t-att-class="'statement-blocked' if line['blocked'] else ''"
>
<td>
<span t-esc="line['move_id']" />
</td>
<td>
<span t-esc="line['date']" />
</td>
<td>
<t t-if="line['name'] != '/'">
<t t-if="not line['ref'] and line['name']">
<span t-esc="line['name']" />
</t>
<t t-if="line['ref'] and not line['name']">
<span t-esc="line['ref']" />
</t>
<t t-if="line['ref'] and line['name']">
<t
t-if="line['name'] not in line['ref'] or line['name'] == line['ref']"
>
<span t-esc="line['name']" />
</t>
<t
t-if="line['ref'] not in line['name']"
>
<span t-esc="line['ref']" />
</t>
</t>
</t>
<t t-if="line['name'] == '/'">
<span t-esc="line['ref']" />
</t>
</td>
<td class="amount">
<span
t-esc="line['amount']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
<td class="amount">
<span
t-esc="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
<tr>
<td />
<td>
<span t-esc="d['end']" />
</td>
<td>
Ending Balance
</td>
<td />
<td class="amount">
<span
t-esc="currency['amount_due']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
</tbody>
</table>
<t
t-call="partner_statement.activity_balance"
name="activity"
/>
<t
t-call="partner_statement.aging_buckets"
t-if="currency['buckets']"

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 ForgeFlow, S.L. (https://www.forgeflow.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="detailed_activity_statement_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang': lang})" />
<t t-set="address">
<address
t-esc="get_inv_addr(o)"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'
/>
<div t-if="o.vat" class="mt16"><t
t-esc="company.country_id.vat_label or 'Tax ID'"
/>: <span t-field="o.vat" /></div>
</t>
<div class="page">
<h2>Statement of Account</h2>
<div id="informations" class="row mt32 mb32">
<div class="col-3 bm-2">
<strong>Date:</strong>
<p t-esc="d['today']" class="m-0" />
</div>
<div class="col-3 bm-2">
<strong>Partner Name:</strong>
<p t-field="o.name" class="m-0" />
</div>
<div t-if="o.ref" class="col-3 bm-2">
<strong>Partner Code:</strong>
<p t-field="o.ref" class="m-0" />
</div>
</div>
<t t-if="d['currencies']">
<br />
<t t-foreach="d['currencies'].items()" t-as="currency">
<t t-set="display_currency" t-value="Currencies[currency[0]]" />
<t t-set="currency" t-value="currency[1]" />
<t t-set="line_type" t-value="'prior_lines'" />
<t t-set="title_name" t-value="'Prior Balance'" />
<t
t-set="ending_amount"
t-value="currency['balance_forward']"
/>
<t t-set="ending_date" t-value="d['prior_day']" />
<t
t-call="partner_statement.outstanding_balance"
name="prior_balance"
/>
<t
t-call="partner_statement.activity_balance"
name="detailed_activity"
/>
<t t-set="line_type" t-value="'ending_lines'" />
<t t-set="title_name" t-value="'Ending Balance'" />
<t t-set="ending_amount" t-value="currency['amount_due']" />
<t t-set="ending_date" t-value="d['end']" />
<t
t-call="partner_statement.outstanding_balance"
name="ending_balance"
/>
<t
t-call="partner_statement.aging_buckets"
t-if="currency['buckets']"
/>
</t>
</t>
<p t-if="d.get('no_entries')">
<strong>The partner doesn't have due entries.</strong>
</p>
</div>
</t>
</template>
<template id="detailed_activity_statement">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="d" t-value="data.get(o.id)" />
<t
t-call="partner_statement.detailed_activity_statement_document"
t-lang="o.lang"
/>
</t>
</t>
</template>
<record id="action_print_detailed_activity_statement" model="ir.actions.report">
<field name="name">Detailed Activity Statement</field>
<field name="model">res.partner</field>
<field name="report_name">partner_statement.detailed_activity_statement</field>
<field name="report_type">qweb-pdf</field>
<field name="report_file">partner_statement.detailed_activity_statement</field>
</record>
<record
id="action_print_detailed_activity_statement_html"
model="ir.actions.report"
>
<field name="name">Detailed Activity Statement</field>
<field name="model">res.partner</field>
<field name="report_name">partner_statement.detailed_activity_statement</field>
<field name="report_type">qweb-html</field>
<field name="report_file">partner_statement.detailed_activity_statement</field>
</record>
<record
id="action_print_detailed_activity_statement_xlsx"
model="ir.actions.report"
>
<field name="name">Detailed Activity Statement XLSX</field>
<field name="model">res.partner</field>
<field name="type">ir.actions.report</field>
<field name="report_name">p_s.report_detailed_activity_statement_xlsx</field>
<field name="report_type">xlsx</field>
<field name="report_file">report_detailed_activity_statement</field>
</record>
</odoo>

View File

@@ -2,6 +2,104 @@
<!-- Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="outstanding_balance">
<p>
<span t-esc="'' if account_type == 'receivable' else 'Supplier '" /><span
t-esc="title_name"
/> up to <span t-esc="ending_date" /> in <span
t-esc="display_currency.name"
/>
</p>
<table class="table table-sm table-statement">
<thead>
<tr>
<th>Reference number</th>
<th>Date</th>
<th>Due Date</th>
<th>Description</th>
<th class="amount">Original</th>
<th class="amount">Open Amount</th>
<th class="amount">Balance</th>
</tr>
</thead>
<tbody>
<tr
t-foreach="currency[line_type]"
t-as="line"
t-att-class="'statement-blocked' if line['blocked'] else ''"
>
<td>
<span t-esc="line['move_id']" />
</td>
<td>
<span t-esc="line['date']" />
</td>
<td>
<span t-esc="line['date_maturity']" />
</td>
<td>
<t t-if="line['name'] != '/'">
<t t-if="not line['ref']">
<span t-esc="line['name']" />
</t>
<t t-if="line['ref'] and not line['name']">
<span t-esc="line['ref']" />
</t>
<t t-if="line['ref'] and line['name']">
<t
t-if="line['name'] not in line['ref'] or line['name'] == line['ref']"
>
<span t-esc="line['name']" />
</t>
<t t-if="line['ref'] not in line['name']">
<span t-esc="line['ref']" />
</t>
</t>
</t>
<t t-if="line['name'] == '/'">
<span t-esc="line['ref']" />
</t>
</td>
<td class="amount">
<span
t-esc="line['amount']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
<td class="amount">
<span
t-esc="line['open_amount']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
<td class="amount">
<span
t-esc="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
<tr>
<td />
<td>
<span t-esc="ending_date" />
</td>
<td>
Ending Balance
</td>
<td />
<td />
<td />
<td class="amount">
<span
t-esc="ending_amount"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
</tbody>
</table>
</template>
<template id="partner_statement.outstanding_statement_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang': lang})" />
@@ -36,104 +134,14 @@
<t t-foreach="d['currencies'].items()" t-as="currency">
<t t-set="display_currency" t-value="Currencies[currency[0]]" />
<t t-set="currency" t-value="currency[1]" />
<p>
<span
t-esc="'' if account_type == 'receivable' else 'Supplier '"
/>Statement up to <span t-esc="d['end']" /> in <span
t-esc="display_currency.name"
/>
</p>
<table class="table table-sm table-statement">
<thead>
<tr>
<th>Reference number</th>
<th>Date</th>
<th>Due Date</th>
<th>Description</th>
<th class="amount">Original</th>
<th class="amount">Open Amount</th>
<th class="amount">Balance</th>
</tr>
</thead>
<tbody>
<tr
t-foreach="currency['lines']"
t-as="line"
t-att-class="'statement-blocked' if line['blocked'] else ''"
>
<td>
<span t-esc="line['move_id']" />
</td>
<td>
<span t-esc="line['date']" />
</td>
<td>
<span t-esc="line['date_maturity']" />
</td>
<td>
<t t-if="line['name'] != '/'">
<t t-if="not line['ref']">
<span t-esc="line['name']" />
</t>
<t t-if="line['ref'] and not line['name']">
<span t-esc="line['ref']" />
</t>
<t t-if="line['ref'] and line['name']">
<t
t-if="line['name'] not in line['ref'] or line['name'] == line['ref']"
>
<span t-esc="line['name']" />
</t>
<t
t-if="line['ref'] not in line['name']"
>
<span t-esc="line['ref']" />
</t>
</t>
</t>
<t t-if="line['name'] == '/'">
<span t-esc="line['ref']" />
</t>
</td>
<td class="amount">
<span
t-esc="line['amount']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
<td class="amount">
<span
t-esc="line['open_amount']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
<td class="amount">
<span
t-esc="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
<tr>
<td />
<td>
<span t-esc="d['end']" />
</td>
<td>
Ending Balance
</td>
<td />
<td />
<td />
<td class="amount">
<span
t-esc="currency['amount_due']"
t-options="{'widget': 'monetary', 'display_currency': display_currency}"
/>
</td>
</tr>
</tbody>
</table>
<t t-set="line_type" t-value="'lines'" />
<t t-set="title_name" t-value="'Statement'" />
<t t-set="ending_amount" t-value="currency['amount_due']" />
<t t-set="ending_date" t-value="d['end']" />
<t
t-call="partner_statement.outstanding_balance"
name="outstanding"
/>
<t
t-call="partner_statement.aging_buckets"
t-if="currency['buckets']"