Skip to main content

Enforce uniqueness on bank accounts

Project description

.. image::
:alt: License: AGPL-3

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

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

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


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

Bug Tracker

Bugs are tracked on
`GitHub Issues <>`_.



* Holger Brunn <>
* Ronald Portier <>


.. image::
:alt: 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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for odoo8-addon-base-bank-account-number-unique, version
Filename, size File type Python version Upload date Hashes
Filename, size odoo8_addon_base_bank_account_number_unique- (19.1 kB) File type Wheel Python version py2 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page