Try to reconcile only valid account move line

Closes #13847
This commit is contained in:
Cédric Krier
2025-01-29 18:20:46 +01:00
parent d6764027f1
commit 60cd69732f
+6 -1
View File
@@ -2241,7 +2241,9 @@ class Reconcile(Wizard):
.join(account_type, condition=account.type == account_type.id)
.select(
account.id,
where=((line.reconciliation == Null) & account.reconcile
where=((line.reconciliation == Null)
& (line.state == 'valid')
& account.reconcile
& account.id.in_(account_rule)),
group_by=[account.id,
account_type.receivable, account_type.payable],
@@ -2269,6 +2271,7 @@ class Reconcile(Wizard):
return list({l.party for l in lines if l.account == account})
where = ((line.reconciliation == Null)
& (line.state == 'valid')
& (line.account == account.id))
if party:
where &= (line.party == party.id)
@@ -2308,6 +2311,7 @@ class Reconcile(Wizard):
else_=False)
)
where = ((line.reconciliation == Null)
& (line.state == 'valid')
& (line.account == account.id)
& (line.party == (party.id if party else None)))
currency_expr = Coalesce(line.second_currency, account.currency.id)
@@ -2427,6 +2431,7 @@ class Reconcile(Wizard):
],
('second_currency', '=', self.show.currency.id),
],
('state', '=', 'valid'),
],
order=[])