Unique bank account numbers

by ,
Odoo
v 8.0 Third Party 182
Download for v 8.0
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Social Network (mail)
Community Apps Dependencies
Technical Name base_bank_account_number_unique
LicenseAGPL-3
You bought this module and need support? Click here!

Unique bank account numbers

It can be desirable to be able to rely on a bank account number identifying exactly one partner. This module allows you to enforce this, so that an account number is unique in the system.

There are some valid corner cases were it is valid to have multiple records for the same account number. For instance in a multicompany setup where the bank-account linked to one company, is a partner bank account for another company.

Because of these corner cases, the constraint is no longer implemented as a SQL unique index. This has the added advantage, that the module can be installed on databases where the bank-account numbers are not unique already.

To find records that are not unique, you could use the following SQL statement:

with res_partner_bank_sanitized as (
    select
        id, acc_number, coalesce(company_id, 0) as company_id,
        sanitized_acc_number
    from res_partner_bank
),
res_partner_bank_sanitized_grouped as (
    select
        array_agg(id) ids, sanitized_acc_number, count(*) kount,
        company_id
    from res_partner_bank_sanitized
    group by sanitized_acc_number, company_id
)
select * from res_partner_bank_sanitized_grouped where kount > 1;

Installation

The constraint is active for new and changed numbers, from the moment of installation.

Bug Tracker

Bugs are tracked on GitHub Issues.

Credits

Contributors

Maintainer

Odoo Community Association

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.