Browse Source

Merge pull request #3 from aschenkels-ictstudio/patch-1

[FIX] Currency check / Limit
pull/99/head
Holger Brunn 8 years ago
committed by GitHub
parent
commit
412fc21605
  1. 13
      account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_exact_amount.py

13
account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_exact_amount.py

@ -29,11 +29,10 @@ class AccountBankStatementImportAutoReconcileExactAmount(models.AbstractModel):
amount_field = 'debit'
sign = 1
if statement_line.currency_id or statement_line.journal_id.currency:
if statement_line.amount < 0:
amount_field = 'credit'
sign = -1
else:
amount_field = 'amount_currency'
amount_field = 'amount_currency'
elif statement_line.amount < 0:
amount_field = 'credit'
sign = -1
domain = [
'|', '|', '|',
@ -47,7 +46,7 @@ class AccountBankStatementImportAutoReconcileExactAmount(models.AbstractModel):
('partner_id', '=', statement_line.partner_id.id),
(amount_field, '=', self._round(sign * statement_line.amount)),
]
move_lines = self.env['account.move.line'].search(domain, limit=1)
if move_lines:
move_lines = self.env['account.move.line'].search(domain, limit=2)
if move_lines and len(move_lines) == 1:
self._reconcile_move_line(statement_line, move_lines.id)
return True
Loading…
Cancel
Save