diff options
| author | Nathan de Pryck <nde@odoo.com> | 2019-02-13 18:11:01 +0100 |
|---|---|---|
| committer | De Paoli Quentin <qdp@odoo.com> | 2019-02-14 09:13:24 +0100 |
| commit | db691dbebf27d2c0169b1528dd79862decd0b05e (patch) | |
| tree | c2d9472d27e5f15af14926c7881cbe63f91c039d | |
| parent | 9773be345e1ece19180727b748790b538949e473 (diff) | |
[FIX] account: reverse entry when account move line contains 0 in credit or debit
In some case, when the user enter by mistake an account move line
with an amount of 0,the reverse operation does not works properly.
The issue happenned during the reverse operation because it tries to
reconcile a 0 account move line with no matches (credit or debit).
See opw-1931961
| -rw-r--r-- | addons/account/models/account_move.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 0b3f1c75e71..3cbef204750 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -330,7 +330,7 @@ class AccountMoveLine(models.Model): #we can only check the amount in company currency reconciled = False digits_rounding_precision = line.company_id.currency_id.rounding - if float_is_zero(amount, precision_rounding=digits_rounding_precision): + if (line.matched_debit_ids or line.matched_credit_ids) and float_is_zero(amount, precision_rounding=digits_rounding_precision): if line.currency_id and line.amount_currency: if float_is_zero(amount_residual_currency, precision_rounding=line.currency_id.rounding): reconciled = True @@ -948,7 +948,7 @@ class AccountMoveLine(models.Model): all_accounts.append(line.account_id) if (line.account_id.internal_type in ('receivable', 'payable')): partners.add(line.partner_id.id) - if line.reconciled: + if (line.matched_debit_ids or line.matched_credit_ids) and line.reconciled: raise UserError(_('You are trying to reconcile some entries that are already reconciled!')) if len(company_ids) > 1: raise UserError(_('To reconcile the entries company should be the same for all entries!')) |
