Browse Source

FIX when transaction.payee is not set: don't detect wrong bank_account/partner (it used to match that res.partner.bank that have an empty 'owner_name')

pull/54/head
Alexis de Lattre 9 years ago
parent
commit
606e32c6ad
  1. 13
      account_bank_statement_import_ofx/account_bank_statement_import_ofx.py

13
account_bank_statement_import_ofx/account_bank_statement_import_ofx.py

@ -45,12 +45,13 @@ 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
banks = self.env['res.partner.bank'].search(
[('owner_name', '=', transaction.payee)], limit=1)
if banks:
bank_account = banks[0]
bank_account_id = bank_account.id
partner_id = bank_account.partner_id.id
if transaction.payee:
banks = self.env['res.partner.bank'].search(
[('owner_name', '=', transaction.payee)], limit=1)
if banks:
bank_account = banks[0]
bank_account_id = bank_account.id
partner_id = bank_account.partner_id.id
vals_line = { vals_line = {
'date': transaction.date, 'date': transaction.date,
'name': transaction.payee + ( 'name': transaction.payee + (

Loading…
Cancel
Save