mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] Support use of transaction name in statement line and move
By setting transaction.name, an import filter can supply description text from the bank to make it easier to understand a line in the bank statement and the resulting move
This commit is contained in:
@@ -500,7 +500,7 @@ class account_bank_statement(osv.osv):
|
||||
'journal_id': st.journal_id.id,
|
||||
'period_id': period_id, # AB
|
||||
'date': st_line.date,
|
||||
'name': st_line_number,
|
||||
'name': "%s.%s" % (st_line.statement_id.name, st_line.import_transaction_id.id),
|
||||
}, context=context)
|
||||
account_bank_statement_line_obj.write(cr, uid, [st_line.id], {
|
||||
'move_ids': [(4, move_id, False)]
|
||||
|
||||
@@ -1391,8 +1391,11 @@ class banking_import_transaction(osv.osv):
|
||||
values['partner_bank_id'] = partner_banks[0].id
|
||||
|
||||
if not transaction.statement_line_id:
|
||||
if not hasattr(transaction, 'name'):
|
||||
transaction.name = '%s.%s' % (transaction.statement, transaction.transaction)
|
||||
|
||||
values.update(dict(
|
||||
name = '%s.%s' % (transaction.statement, transaction.transaction),
|
||||
name = transaction.name,
|
||||
date = transaction.effective_date,
|
||||
amount = transaction.transferred_amount,
|
||||
statement_id = transaction.statement_id.id,
|
||||
@@ -1599,6 +1602,7 @@ class banking_import_transaction(osv.osv):
|
||||
'exchange_rate': fields.float('exchange_rate'),
|
||||
'transferred_amount': fields.float('transferred_amount'),
|
||||
'message': fields.char('message', size=1024),
|
||||
'name': fields.char('name', size=1024),
|
||||
'remote_owner': fields.char('remote_owner', size=24),
|
||||
'remote_owner_address': fields.char('remote_owner_address', size=24),
|
||||
'remote_owner_city': fields.char('remote_owner_city', size=24),
|
||||
|
||||
@@ -68,6 +68,9 @@ class mem_bank_transaction(object):
|
||||
|
||||
'id',
|
||||
# Message id
|
||||
|
||||
'name',
|
||||
# Optional transaction name
|
||||
|
||||
'statement_id',
|
||||
# The bank statement this message was reported on
|
||||
|
||||
@@ -292,7 +292,7 @@ class banking_import(osv.osv_memory):
|
||||
subno = 0
|
||||
for transaction in statement.transactions:
|
||||
subno += 1
|
||||
if not transaction.id:
|
||||
if not transaction.id and not transaction.name:
|
||||
transaction.id = str(subno)
|
||||
values = {}
|
||||
for attr in transaction.__slots__ + ['type']:
|
||||
|
||||
Reference in New Issue
Block a user