diff options
| author | Laurent Smet <las@odoo.com> | 2021-01-28 12:18:52 +0000 |
|---|---|---|
| committer | Laurent Smet <las@odoo.com> | 2021-01-28 12:26:22 +0000 |
| commit | 73ddcfbcc58b7a6542ced4bd8b20dd67c9f446ee (patch) | |
| tree | 662f0f83394045c65804cfaa1654730b7d449a16 /addons/account/models/account_bank_statement.py | |
| parent | d5e503f02f94ea4125010f09b1877040c8fc68b3 (diff) | |
[FIX] account: Fix 'is_reconciled' flag for zero-amount statement line
When the suspense account is not reconcilable, 'suspense_lines.reconciled' always gives 'False' leading to a not reconciled statement line.
closes odoo/odoo#65211
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/account/models/account_bank_statement.py')
| -rw-r--r-- | addons/account/models/account_bank_statement.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 805cc6b7e31..837bd1a714d 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -781,27 +781,27 @@ class AccountBankStatementLine(models.Model): for st_line in self: liquidity_lines, suspense_lines, other_lines = st_line._seek_for_lines() + # Compute residual amount + if st_line.to_check: + st_line.amount_residual = -st_line.amount_currency if st_line.foreign_currency_id else -st_line.amount + elif suspense_lines.account_id.reconcile: + st_line.amount_residual = sum(suspense_lines.mapped('amount_residual_currency')) + else: + st_line.amount_residual = sum(suspense_lines.mapped('amount_currency')) + # Compute is_reconciled if not st_line.id: # New record: The journal items are not yet there. st_line.is_reconciled = False elif suspense_lines: # In case of the statement line comes from an older version, it could have a residual amount of zero. - st_line.is_reconciled = all(suspense_line.reconciled for suspense_line in suspense_lines) + st_line.is_reconciled = suspense_lines.currency_id.is_zero(st_line.amount_residual) elif st_line.currency_id.is_zero(st_line.amount): st_line.is_reconciled = True else: # The journal entry seems reconciled. st_line.is_reconciled = True - # Compute residual amount - if st_line.to_check: - st_line.amount_residual = -st_line.amount_currency if st_line.foreign_currency_id else -st_line.amount - elif suspense_lines.account_id.reconcile: - st_line.amount_residual = sum(suspense_lines.mapped('amount_residual_currency')) - else: - st_line.amount_residual = sum(suspense_lines.mapped('amount_currency')) - # ------------------------------------------------------------------------- # CONSTRAINT METHODS # ------------------------------------------------------------------------- |
