|
@ -45,6 +45,7 @@ class AccountBankStatementImport(models.TransientModel): |
|
|
# (normal behavious is to provide 'account_number', which the |
|
|
# (normal behavious is to provide 'account_number', which the |
|
|
# generic module uses to find partner/bank) |
|
|
# generic module uses to find partner/bank) |
|
|
bank_account_id = partner_id = False |
|
|
bank_account_id = partner_id = False |
|
|
|
|
|
if transaction.payee: |
|
|
banks = self.env['res.partner.bank'].search( |
|
|
banks = self.env['res.partner.bank'].search( |
|
|
[('owner_name', '=', transaction.payee)], limit=1) |
|
|
[('owner_name', '=', transaction.payee)], limit=1) |
|
|
if banks: |
|
|
if banks: |
|
@ -61,6 +62,18 @@ class AccountBankStatementImport(models.TransientModel): |
|
|
'bank_account_id': bank_account_id, |
|
|
'bank_account_id': bank_account_id, |
|
|
'partner_id': partner_id, |
|
|
'partner_id': partner_id, |
|
|
} |
|
|
} |
|
|
|
|
|
# Memo (<NAME>) and payee (<PAYEE>) are not required |
|
|
|
|
|
# field in OFX statement, cf section 11.4.3 Statement |
|
|
|
|
|
# Transaction <STMTTRN> of the OFX specs: the required |
|
|
|
|
|
# elements are in bold, cf 1.5 Conventions and these 2 |
|
|
|
|
|
# fields are not in bold. |
|
|
|
|
|
# But the 'name' field of account.bank.statement.line is |
|
|
|
|
|
# required=True, so we must always have a value ! |
|
|
|
|
|
# The field TRNTYPE is a required field in OFX |
|
|
|
|
|
if not vals_line['name']: |
|
|
|
|
|
vals_line['name'] = transaction.type.capitalize() |
|
|
|
|
|
if transaction.checknum: |
|
|
|
|
|
vals_line['name'] += ' %s' % transaction.checknum |
|
|
total_amt += float(transaction.amount) |
|
|
total_amt += float(transaction.amount) |
|
|
transactions.append(vals_line) |
|
|
transactions.append(vals_line) |
|
|
except Exception, e: |
|
|
except Exception, e: |
|
|