Skip to content

Commit 6db036e

Browse files
committed
[IMP] account_payment_partner: Add options to show partner bank account in invoice report
1 parent 8d1cb34 commit 6db036e

File tree

6 files changed

+73
-10
lines changed

6 files changed

+73
-10
lines changed

account_payment_partner/README.rst

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Contributors
6767
* Stéphane Bidoul <[email protected]>
6868
* Danimar Ribeiro
6969
* Angel Moya <[email protected]>
70+
* `Tecnativa <https://www.tecnativa.com>`_:
71+
* Carlos Dauden
7072

7173
Maintainer
7274
----------

account_payment_partner/__manifest__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# -*- coding: utf-8 -*-
2-
# © 2014 Akretion - Alexis de Lattre <[email protected]>
3-
# © 2014 Tecnativa - Pedro M. Baeza
2+
# Copyright 2014 Akretion - Alexis de Lattre <[email protected]>
3+
# Copyright 2014 Tecnativa - Pedro M. Baeza
4+
# Copyright 2018 Tecnativa - Carlos Dauden
45
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
56

67
{
78
'name': 'Account Payment Partner',
8-
'version': '10.0.1.1.2',
9+
'version': '10.0.1.2.0',
910
'category': 'Banking addons',
1011
'license': 'AGPL-3',
1112
'summary': 'Adds payment mode on partners and invoices',
@@ -18,6 +19,7 @@
1819
'views/res_partner_view.xml',
1920
'views/account_invoice_view.xml',
2021
'views/account_move_line.xml',
22+
'views/account_payment_method.xml',
2123
'views/report_invoice.xml',
2224
],
2325
'demo': ['demo/partner_demo.xml'],

account_payment_partner/models/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
from . import res_partner
44
from . import account_invoice
55
from . import account_move_line
6+
from . import account_payment_method
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2018 Carlos Dauden - Tecnativa <[email protected]>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
from odoo import fields, models
6+
7+
8+
class AccountPaymentMethod(models.Model):
9+
_inherit = 'account.payment.method'
10+
11+
show_bank_account = fields.Selection(
12+
[
13+
('full', 'Full'),
14+
('first', 'First n chars'),
15+
('last', 'Last n chars'),
16+
('no', 'No'),
17+
],
18+
string='Show bank account',
19+
default='full',
20+
help="Show in invoices partial or full bank account number")
21+
show_bank_account_chars = fields.Integer(
22+
string="Number of chars",
23+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2018 Carlos Dauden - Tecnativa <[email protected]>
3+
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
4+
<odoo>
5+
6+
7+
<record id="account_payment_method_form" model="ir.ui.view">
8+
<field name="model">account.payment.method</field>
9+
<field name="inherit_id" ref="account_payment_mode.account_payment_method_form"/>
10+
<field name="arch" type="xml">
11+
<field name="bank_account_required" position="after">
12+
<field name="show_bank_account"/>
13+
<field name="show_bank_account_chars"
14+
attrs="{'invisible': [('show_bank_account', 'not in', ['first', 'last'])]}"/>
15+
</field>
16+
</field>
17+
</record>
18+
19+
20+
</odoo>

account_payment_partner/views/report_invoice.xml

+22-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,28 @@
77
<strong>Payment Mode:</strong>
88
<span t-field="o.payment_mode_id.note" />
99
</p>
10-
<p t-if="o.partner_bank_id">
11-
<strong>Bank Account:</strong>
12-
<t t-if="o.partner_bank_id.bank_id">
13-
<t t-esc="o.partner_bank_id.bank_id.name + ('' if not o.partner_bank_id.bank_id.bic else ' (' + o.partner_bank_id.bank_id.bic + ')')" />
14-
</t>
15-
<span t-field="o.partner_bank_id.acc_number" />
16-
</p>
10+
<t t-set="payment_method"
11+
t-value="o.payment_mode_id.payment_method_id"/>
12+
<t t-if="payment_method and payment_method.show_bank_account != 'no'">
13+
<t t-set="partner_bank"
14+
t-value="o.partner_bank_id or payment_method.code == 'sepa_direct_debit' and (o.mandate_id.partner_bank_id or o.partner_id.valid_mandate_id.partner_bank_id) or False"/>
15+
<p t-if="partner_bank">
16+
<span t-esc="payment_method.show_bank_account"/>
17+
<strong>Bank Account:</strong>
18+
<t t-if="partner_bank.bank_id">
19+
<t t-esc="partner_bank.bank_id.name + ('' if not partner_bank.bank_id.bic else ' (' + partner_bank.bank_id.bic + ')')" />
20+
</t>
21+
<t t-if="payment_method.show_bank_account == 'full'">
22+
<span t-field="partner_bank.acc_number"/>
23+
</t>
24+
<t t-elif="payment_method.show_bank_account == 'first'">
25+
<span t-esc="partner_bank.acc_number[:payment_method.show_bank_account_chars] + '*' * (len(partner_bank.acc_number) - payment_method.show_bank_account_chars)"/>
26+
</t>
27+
<t t-elif="payment_method.show_bank_account == 'last'">
28+
<span t-esc="'*' * (len(partner_bank.acc_number) - payment_method.show_bank_account_chars) + partner_bank.acc_number[payment_method.show_bank_account_chars:]"/>
29+
</t>
30+
</p>
31+
</t>
1732
</xpath>
1833
</template>
1934

0 commit comments

Comments
 (0)