Browse Source

[FIX] Currency check / Limit

[FIX] Changed if statement for currency check. Now it will also include the normal purchase invoices (not multicurrency)
[FIX] Changed limit to 2 and added a check to see if more then 1 move line is returned. If so don't reconcile
pull/99/head
André Schenkels 8 years ago
committed by GitHub
parent
commit
ef3bca4000
  1. 9
      account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_exact_amount.py

9
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' amount_field = 'debit'
sign = 1 sign = 1
if statement_line.currency_id or statement_line.journal_id.currency: if statement_line.currency_id or statement_line.journal_id.currency:
if statement_line.amount < 0:
amount_field = 'amount_currency'
elif statement_line.amount < 0:
amount_field = 'credit' amount_field = 'credit'
sign = -1 sign = -1
else:
amount_field = 'amount_currency'
domain = [ domain = [
'|', '|', '|', '|', '|', '|',
@ -47,7 +46,7 @@ class AccountBankStatementImportAutoReconcileExactAmount(models.AbstractModel):
('partner_id', '=', statement_line.partner_id.id), ('partner_id', '=', statement_line.partner_id.id),
(amount_field, '=', self._round(sign * statement_line.amount)), (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) self._reconcile_move_line(statement_line, move_lines.id)
return True return True
Loading…
Cancel
Save