Skip to content

Commit

Permalink
[FIX] account: reconciliation widget: don't show draft entries
Browse files Browse the repository at this point in the history
Before that, draft entries were taken into account in reconciliation propositions; which made no sense.

11.3 version of #39954

closes #39965

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
  • Loading branch information
oco-odoo committed Nov 7, 2019
1 parent 3a7ca43 commit 29c207a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addons/account/models/reconciliation_widget.py
Expand Up @@ -291,13 +291,15 @@ def get_data_for_manual_reconciliation(self, res_type, res_ids=None, account_typ
AND EXISTS (
SELECT NULL
FROM account_move_line l
JOIN account_move move ON move.id = l.move_id AND move.state = 'posted'
WHERE l.account_id = a.id
{7}
AND l.amount_residual > 0
)
AND EXISTS (
SELECT NULL
FROM account_move_line l
JOIN account_move move ON move.id = l.move_id AND move.state = 'posted'
WHERE l.account_id = a.id
{7}
AND l.amount_residual < 0
Expand Down Expand Up @@ -484,7 +486,7 @@ def _domain_move_lines_for_reconciliation(self, st_line, aml_accounts, partner_i
@api.model
def _domain_move_lines_for_manual_reconciliation(self, account_id, partner_id=False, excluded_ids=None, search_str=False):
""" Create domain criteria that are relevant to manual reconciliation. """
domain = ['&', ('reconciled', '=', False), ('account_id', '=', account_id)]
domain = ['&', '&', ('reconciled', '=', False), ('account_id', '=', account_id), ('move_id.state', '=', 'posted')]
if partner_id:
domain = expression.AND([domain, [('partner_id', '=', partner_id)]])
if excluded_ids:
Expand Down Expand Up @@ -704,8 +706,10 @@ def _get_move_line_reconciliation_proposition(self, account_id, partner_id=None)
# Get pairs
query = """
SELECT a.id, b.id
FROM account_move_line a, account_move_line b
FROM account_move_line a, account_move_line b, account_move move_a, account_move move_b
WHERE a.id != b.id
AND move_a.id = a.move_id AND move_a.state = 'posted'
AND move_b.id = b.move_id AND move_b.state = 'posted'
AND a.amount_residual = -b.amount_residual
AND NOT a.reconciled
AND a.account_id = %s
Expand Down

0 comments on commit 29c207a

Please sign in to comment.