[FIX] account: bank reconciliation was auto-reconciling undistincly debit lines on bank accounts with negative amounts and/or credit lines with positive amounts where only one field (debit/credit) should be checked if the amount is positive/negative.

This commit is contained in:
qdp-odoo
2016-07-08 17:03:25 +02:00
parent 6a3cf82130
commit 68f0b8fe4e
@@ -576,10 +576,11 @@ class AccountBankStatementLine(models.Model):
domain = [(f, '>', 0), (f, '<', amount)]
elif comparator == '=':
if f == 'amount_residual':
liquidity_field = amount > 0 and 'debit' or 'credit'
domain = [
'|', (f, '=', float_round(amount, precision_digits=p)),
'&', ('account_id.internal_type', '=', 'liquidity'),
'|', ('debit', '=', amount), ('credit', '=', amount),
(liquidity_field, '=', amount),
]
else:
domain = [