fix!: handle multiple companies' bank accounts with one EBICS User - #405
fix!: handle multiple companies' bank accounts with one EBICS User#405PatrickDEissler wants to merge 4 commits into
Conversation
Confidence Score: 4/5This PR is not safe to merge until ambiguous historical IBAN matches stop cross-company routing and existing duplicate records remain administratively manageable. The importer still continues with the first account when historical duplicates match a statement, while the newly added global validation does not migrate those records and instead prevents either duplicate account from being saved during routine maintenance. Files Needing Attention: banking/ebics/utils.py and banking/overrides/bank_account.py
|
There was a problem hiding this comment.
I think having multiple Bank Accounts with the same IBAN is a configuration error, not a valid scenario. We can validate and log errors, but should not handle it in sync.
IMO the accurate fix should be:
- replace
companyfield in Ebics User with a data fieldorganization_name(and add a patch) - this is still needed for certificates - drop
companyfromget_bank_account()(param and argument) - drop
companyfromprocess_camt_document()and all downstream function calls. No need to fetch it explicitly, it should be set via Bank Transaction's fetch_from. - add duplicate IBAN validation to Bank Account
- in
get_bank_account, use get_all, log an error if more than 1 result, return the first result
@barredterra |
Solves: #404
Further note:
process_camt_documenthad to be adjusted, because it relied on transactions for one Company per EBICS User.