Add bank name and currency code to bank account rec_name

issue8908
review288681002
This commit is contained in:
Maxime Richez
2020-01-11 23:56:16 +01:00
parent 2132af5c0f
commit 0f00cc82bb
2 changed files with 15 additions and 2 deletions
+2
View File
@@ -1,3 +1,5 @@
* Show bank and currency in account record name
Version 5.4.0 - 2019-11-04
* Bug fixes (see mercurial logs for details)
* Validate and format BIC
+13 -2
View File
@@ -59,11 +59,22 @@ class BankAccount(DeactivableMixin, ModelSQL, ModelView):
help="Add the numbers which identify the bank account.")
def get_rec_name(self, name):
return self.numbers[0].number
name = '%s @ %s' % (self.numbers[0].number, self.bank.rec_name)
if self.currency:
name += ' [%s]' % self.currency.code
return name
@classmethod
def search_rec_name(cls, name, clause):
return [('numbers',) + tuple(clause[1:])]
if clause[1].startswith('!') or clause[1].startswith('not '):
bool_op = 'AND'
else:
bool_op = 'OR'
return [bool_op,
('bank.rec_name',) + tuple(clause[1:]),
('currency',) + tuple(clause[1:]),
('numbers',) + tuple(clause[1:]),
]
class BankAccountNumber(sequence_ordered(), ModelSQL, ModelView):