I actually realized this problem can be solved by custom fields.
First you define custom field on bank account or cash account and make sure Show custom field on printed documents
is checked. Then edit bank account or cash account to make sure custom field has text.
Your custom field will be then automatically shown on every bank/cash transaction.
Technically you can create a custom field called “Bank account” and put into this field the name of the bank account, then it will show on your bank transactions.
You will need the latest version (18.7.60) as previous versions wouldn’t show custom field on bank/cash transactions.