Browse Source

[FIX] #145

pull/146/head
Tom Blauwendraat 7 years ago
parent
commit
b0e16df208
  1. 10
      account_bank_statement_import/models/account_bank_statement_import.py

10
account_bank_statement_import/models/account_bank_statement_import.py

@ -345,9 +345,15 @@ class AccountBankStatementImport(models.TransientModel):
bank_account_id = False bank_account_id = False
partner_account_number = line_vals.get('account_number') partner_account_number = line_vals.get('account_number')
if partner_account_number: if partner_account_number:
partner_model = self.env['res.partner']
partner_with_bank = partner_model.search([
('bank_ids.acc_number', '=', partner_account_number)
], limit=1)
if partner_with_bank:
bank_model = self.env['res.partner.bank'] bank_model = self.env['res.partner.bank']
banks = bank_model.search(
[('acc_number', '=', partner_account_number)], limit=1)
banks = bank_model.search([
('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

Loading…
Cancel
Save