You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.1 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :alt: License: AGPL-3
  3. Unique bank account numbers
  4. ===========================
  5. It can be desirable to be able to rely on a bank account number identifying
  6. exactly one partner. This module allows you to enforce this, so that an
  7. account number is unique in the system.
  8. There are some valid corner cases were it is valid to have multiple records
  9. for the same account number. For instance in a multicompany setup where the
  10. bank-account linked to one company, is a partner bank account for another
  11. company.
  12. Because of these corner cases, the constraint is no longer implemented as
  13. a SQL unique index. This has the added advantage, that the module can be
  14. installed on databases where the bank-account numbers are not unique already.
  15. To find records that are not unique, you could use the following SQL
  16. statement:
  17. .. code-block:: sql
  18. with res_partner_bank_sanitized as (
  19. select
  20. id, acc_number, coalesce(company_id, 0) as company_id,
  21. sanitized_acc_number
  22. from res_partner_bank
  23. ),
  24. res_partner_bank_sanitized_grouped as (
  25. select
  26. array_agg(id) ids, sanitized_acc_number, count(*) kount,
  27. company_id
  28. from res_partner_bank_sanitized
  29. group by sanitized_acc_number, company_id
  30. )
  31. select * from res_partner_bank_sanitized_grouped where kount > 1;
  32. Installation
  33. ============
  34. The constraint is active for new and changed numbers, from the moment of
  35. installation.
  36. Bug Tracker
  37. ===========
  38. Bugs are tracked on
  39. `GitHub Issues <https://github.com/OCA/bank-statement-import/issues>`_.
  40. Credits
  41. =======
  42. Contributors
  43. ------------
  44. * Holger Brunn <hbrunn@therp.nl>
  45. * Ronald Portier <ronald@therp.nl>
  46. Maintainer
  47. ----------
  48. .. image:: https://odoo-community.org/logo.png
  49. :alt: Odoo Community Association
  50. :target: https://odoo-community.org
  51. This module is maintained by the OCA.
  52. OCA, or the Odoo Community Association, is a nonprofit organization whose
  53. mission is to support the collaborative development of Odoo features and
  54. promote its widespread use.
  55. To contribute to this module, please visit http://odoo-community.org.