Browse Source

Merge pull request #42 from akretion/8.0-fix-bug-wrong-variable-name

8.0 FIX 2 variables had the same name (account_number)
pull/43/head
Stefan Rijnhart (Opener) 9 years ago
parent
commit
5c90293e75
  1. 9
      account_bank_statement_import/models/account_bank_statement_import.py

9
account_bank_statement_import/models/account_bank_statement_import.py

@ -299,16 +299,17 @@ class AccountBankStatementImport(models.TransientModel):
# closed. # closed.
partner_id = False partner_id = False
bank_account_id = False bank_account_id = False
account_number = line_vals.get('account_number')
if account_number:
partner_account_number = line_vals.get('account_number')
if partner_account_number:
bank_model = self.env['res.partner.bank'] bank_model = self.env['res.partner.bank']
banks = bank_model.search( banks = bank_model.search(
[('acc_number', '=', account_number)], limit=1)
[('acc_number', '=', partner_account_number)], limit=1)
if banks: if banks:
bank_account_id = banks[0].id bank_account_id = banks[0].id
partner_id = banks[0].partner_id.id partner_id = banks[0].partner_id.id
else: else:
bank_obj = self._create_bank_account(account_number)
bank_obj = self._create_bank_account(
partner_account_number)
bank_account_id = bank_obj and bank_obj.id or False bank_account_id = bank_obj and bank_obj.id or False
line_vals['partner_id'] = partner_id line_vals['partner_id'] = partner_id
line_vals['bank_account_id'] = bank_account_id line_vals['bank_account_id'] = bank_account_id

Loading…
Cancel
Save