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.

73 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. with res_partner_bank_sanitized as (
  18. select
  19. id, acc_number, coalesce(company_id, 0) as company_id,
  20. sanitized_acc_number
  21. from res_partner_bank
  22. ),
  23. res_partner_bank_sanitized_grouped as (
  24. select
  25. array_agg(id) ids, sanitized_acc_number, count(*) kount,
  26. company_id
  27. from res_partner_bank_sanitized
  28. group by sanitized_acc_number, company_id
  29. )
  30. select * from res_partner_bank_sanitized_grouped where kount > 1;
  31. Installation
  32. ============
  33. The constraint is active for new and changed numbers, from the moment of
  34. installation.
  35. Bug Tracker
  36. ===========
  37. Bugs are tracked on
  38. `GitHub Issues <https://github.com/OCA/bank-statement-import/issues>`_.
  39. Credits
  40. =======
  41. Contributors
  42. ------------
  43. * Holger Brunn <hbrunn@therp.nl>
  44. * Ronald Portier <ronald@therp.nl>
  45. Maintainer
  46. ----------
  47. .. image:: https://odoo-community.org/logo.png
  48. :alt: Odoo Community Association
  49. :target: https://odoo-community.org
  50. This module is maintained by the OCA.
  51. OCA, or the Odoo Community Association, is a nonprofit organization whose
  52. mission is to support the collaborative development of Odoo features and
  53. promote its widespread use.
  54. To contribute to this module, please visit http://odoo-community.org.