[ADD]mandates_bank_accounts_portal

This commit is contained in:
2024-09-16 17:16:39 +02:00
committed by Stéphan Sainléger
parent 31b9c39f8c
commit 64891e33df
20 changed files with 1142 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_bank_account" name="Bank account details">
<t t-call="portal.portal_layout">
<t t-set="additional_title">My bank account Details</t>
<form action="/my/bank_account/save" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<div class="row o_portal_details">
<div class="col-lg-12">
<br />
<div t-if="success" class="alert alert-success py-1 mb-2">
<i class="fa fa-fw fa-check-circle" /> Data saved! </div>
<div t-if="error_message" role="alert" class="col-lg-12 alert alert-danger">
<t t-foreach="error_message" t-as="err">
<t t-out="err" />
<br />
</t>
</div>
<div class="row">
<div id="iban"
t-attf-class="form-group #{error.get('acc_number') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="acc_number">IBAN : </label>
<label class="text-danger"> *</label>
<input t-if="can_edit_bank_account" type="text" name="acc_number"
required="True"
t-attf-class="form-control #{error.get('acc_number') and 'is-invalid' or ''}"
t-att-value="acc_number or bank_account.acc_number" />
<span t-if="not can_edit_bank_account" t-field="bank_account.acc_number" />
</div>
<div id="partner_id"
t-attf-class="form-group #{error.get('partner_id') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="partner_id">Contact name: </label>
<input t-if="can_edit_bank_account" type="text" name="partner_id"
required="False"
readonly="True"
t-attf-class="form-control #{error.get('partner_id') and 'is-invalid' or ''}"
t-att-value="partner_id or bank_account.partner_id.name" />
<span t-if="not can_edit_bank_account" t-field="bank_account.partner_id.name" />
</div>
<div id="iban_holder_name_if_different"
t-attf-class="form-group #{error.get('acc_holder_name') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="bank_id">Name of IBAN holder if different : </label>
<input t-if="can_edit_bank_account" type="text" name="acc_holder_name"
t-attf-class="form-control #{error.get('acc_holder_name') and 'is-invalid' or ''}"
t-att-value="acc_holder_name or bank_account.acc_holder_name" />
<span t-if="not can_edit_bank_account" t-field="bank_account.acc_holder_name" />
</div>
<div id="bank_id"
t-attf-class="form-group #{error.get('bank_id') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="bank_id">Banque name : </label>
<select t-if="can_edit_bank_account" type="text" name="bank_id"
t-attf-class="form-control #{error.get('bank_id') and 'is-invalid' or ''}">
<option value="">My bank is not in the list</option>
<t t-foreach="banks or []" t-as="bank">
<option t-att-value="bank.id" t-att-selected="bank.id == bank_account.bank_id.id">
<t t-esc="bank.name" />
</option>
</t>
</select>
<span t-if="not can_edit_bank_account" t-field="bank_account.acc_holder_name" />
</div>
</div>
<br />
<input type="hidden" name="bank_account_id" t-att-value="bank_account_id" />
<input type="hidden" name="redirect" t-att-value="redirect" />
<div style="text-align:right;">
<button type="submit"
class="btn btn-primary ">Save
</button>
</div>
</div>
</div>
</form>
<div style="text-align:right">
<br />
<a href="/my/bank_accounts">
<span class="fa fa-arrow-left" /> Back to my bank accounts list </a>
</div>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_bank_accounts" name="My bank accounts">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True" />
<t t-call="portal.portal_searchbar">
<t t-set="title">Bank accounts</t>
</t>
<t t-if="not bank_accounts">
<p>There are currently no bank accounts for your account.</p>
</t>
<t t-if="bank_accounts" t-call="portal.portal_table">
<thead>
<tr class="active">
<th>IBAN</th>
<th>Contact name</th>
<th>Name of IBAN holder if different</th>
<th>Number of associated mandates</th>
</tr>
</thead>
<tbody>
<t t-foreach="bank_accounts" t-as="bank_account">
<tr>
<td>
<a
t-attf-href="/my/bank_account/#{bank_account.id}?{{ keep_query() }}">
<span t-field="bank_account.acc_number" />
</a>
</td>
<td>
<span t-field="bank_account.partner_id.name" />
</td>
<td>
<span t-field="bank_account.acc_holder_name" />
</td>
<td>
<t t-if="bank_account.associated_mandate_count == 0">
No registrations
</t>
<t t-if="bank_account.associated_mandate_count == 1">
1 registration
</t>
<t t-if="bank_account.associated_mandate_count > 1">
<t t-esc="bank_account.associated_mandate_count" />
records </t>
</td>
</tr>
</t>
</tbody>
</t>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_contract_page_inherit_mandate" name="My Contract inherit mandate"
inherit_id="contract.portal_contract_page" customize_show="True" priority="100">
<xpath expr="//div[@id='product_information']/div" position="inside">
<div t-if="contract.mandate_id" class="row mb-2 mb-sm-1">
<div class="col-12 col-sm-4">
<strong>Direct Debit Mandate</strong>
</div>
<div class="col-12 col-sm-8">
<span
t-field="contract.mandate_id"
/>
</div>
</div>
</xpath>
</template>
</odoo>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template
id="portal_my_home_menu_contract"
name="Portal layout : Mandate menu entries"
inherit_id="portal.portal_breadcrumbs"
priority="35"
>
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li
t-if="page_name == 'Mandates'"
t-attf-class="breadcrumb-item #{'active ' if not contract else ''}"
>
<a
t-if="mandate"
t-attf-href="/my/mandates?{{ keep_query() }}"
>Mandates</a>
<t t-else="">Mandates</t>
</li>
<li t-if="mandate" class="breadcrumb-item active">
<t t-esc="mandate.reference" />
</li>
</xpath>
</template>
<template id="portal_my_home_bank_accounts" name="Bank accounts"
inherit_id="portal.portal_my_home" customize_show="True" priority="100">
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
<t t-call="portal.portal_docs_entry">
<t t-set="title">Bank accounts</t>
<t t-set="url" t-value="'/my/bank_accounts'" />
<t t-set="placeholder_count" t-value="'bank_account_count'" />
</t>
<t t-call="portal.portal_docs_entry">
<t t-set="title">Mandates</t>
<t t-set="url" t-value="'/my/mandates'" />
<t t-set="placeholder_count" t-value="'mandate_count'"/>
</t>
</xpath>
</template>
</odoo>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_mandate" name="Mandate details">
<t t-call="portal.portal_layout">
<t t-set="additional_title">My mandate details</t>
<form action="/my/mandate/save" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<div class="row o_portal_details">
<div class="col-lg-12">
<br />
<div t-if="success" class="alert alert-success py-1 mb-2">
<i class="fa fa-fw fa-check-circle" /> Data saved! </div>
<div t-if="error_message" role="alert" class="col-lg-12 alert alert-danger">
<t t-foreach="error_message" t-as="err">
<t t-out="err" />
<br />
</t>
</div>
<div class="row">
<div id="reference"
t-attf-class="form-group #{error.get('unique_mandate_reference') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="unique_mandate_reference">Reference : </label>
<label class="text-danger"> *</label>
<input t-if="can_edit_mandate" type="text" name="unique_mandate_reference"
required="True"
t-attf-class="form-control #{error.get('unique_mandate_reference') and 'is-invalid' or ''}"
t-att-value="unique_mandate_reference or mandate.unique_mandate_reference" />
<span t-if="not can_edit_mandate" t-field="mandate.unique_mandate_reference" />
</div>
<div id="format"
t-attf-class="form-group #{error.get('format') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="format">Format : </label>
<label class="text-danger"> *</label>
<input t-if="can_edit_mandate" type="text" name="format"
required="True"
t-attf-class="form-control #{error.get('format') and 'is-invalid' or ''}"
t-att-value="format or mandate.format" />
<span t-if="not can_edit_mandate" t-field="mandate.format" />
</div>
</div>
<br />
<input type="hidden" name="mandate_id" t-att-value="mandate_id" />
<input type="hidden" name="redirect" t-att-value="redirect" />
<div style="text-align:right;">
<button type="submit"
class="btn btn-primary ">Save
</button>
</div>
</div>
</div>
</form>
<div style="text-align:right">
<br />
<a href="/my/mandates">
<span class="fa fa-arrow-left" /> Back to my mandates list </a>
</div>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_mandates" name="My mandates">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True" />
<t t-call="portal.portal_searchbar">
<t t-set="title">Mandates</t>
</t>
<t t-if="not mandates">
<p>There are currently no mandates for your account.</p>
</t>
<t t-if="mandates" t-call="portal.portal_table">
<thead>
<tr class="active">
<th>Reference</th>
<th>Format</th>
<th>Contact name</th>
<th>Signature date</th>
<th>Last debit date</th>
<th>Status</th>
<th>Associed IBAN</th>
</tr>
</thead>
<tbody>
<t t-foreach="mandates" t-as="mandate">
<tr>
<td>
<span t-field="mandate.unique_mandate_reference" />
</td>
<td>
<span t-field="mandate.format" />
</td>
<td>
<span t-field="mandate.partner_id" />
</td>
<td>
<span t-field="mandate.last_debit_date" />
</td>
<td>
<span t-field="mandate.signature_date" />
</td>
<td>
<span t-field="mandate.state" />
</td>
<td>
<a t-attf-href="/my/bank_account/#{mandate.partner_bank_id.id}?{{ keep_query() }}">
<span t-field="mandate.partner_bank_id.acc_number" />
</a>
</td>
</tr>
</t>
</tbody>
</t>
</t>
</template>
</odoo>