summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2018-11-22 14:01:49 +0000
committerNicolas Martinelli <nim@odoo.com>2018-11-22 14:08:57 +0000
commit63f077b888bc495d43fead6b11a688bbd21b2063 (patch)
tree9b3cd954c719b86bd9e61a4002d0e761b9cf5e28
parent499cdd57083da462eec0a66bf76be18a3c703101 (diff)
[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
-rw-r--r--addons/account/models/account_move.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index eb479206bad..af14862f417 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -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):