[FIX] account: sort partners in manual reconciliation

When opening the Manual Reconciliation widget, all partners with opened
invoices and payments are fetched.

In some cases, the database might contain a lot of partners without any
reconciliation suggestion; therefore, the partners with suggestions are
'lost' in the view.

This commit sorts the data: we first display the parters with a
suggestion, then the others. This should improve the usability of the
view.

opw-1903575

closes odoo/odoo#28958
This commit is contained in:
Nicolas Martinelli
2018-11-22 14:08:57 +00:00
parent 499cdd5708
commit 63f077b888
+4 -1
View File
@@ -637,7 +637,10 @@ class AccountMoveLine(models.Model):
row['currency_id'] = account.currency_id.id or account.company_id.currency_id.id
partner_id = is_partner and row['partner_id'] or None
row['reconciliation_proposition'] = self.get_reconciliation_proposition(account.id, partner_id)
return rows
# Return the partners with a reconciliation proposition first, since they are most likely to
# be reconciled.
return [r for r in rows if r['reconciliation_proposition']] + [r for r in rows if not r['reconciliation_proposition']]
@api.model
def get_reconciliation_proposition(self, account_id, partner_id=False):