From 0a5955bff62bc313f7b60f8f7b7a11f262daeb70 Mon Sep 17 00:00:00 2001 From: wan Date: Wed, 28 Aug 2019 13:57:40 +0000 Subject: [PATCH] [IMP] account: improve list and search view of account move line Task 2008956 * Remove the sequence from the default order of account.move.line as it is only needed in the list view of the invoice form view; add it there. * Allow to order by date on the grouped list view of account.move.line by setting an aggregate function --- addons/account/models/account_move.py | 4 ++-- addons/account/views/account_move_views.xml | 10 +++++++--- addons/account/views/account_payment_view.xml | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 604aae8d046..a8897201050 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2123,14 +2123,14 @@ class AccountMove(models.Model): class AccountMoveLine(models.Model): _name = "account.move.line" _description = "Journal Item" - _order = "sequence, date desc, move_name desc, id" + _order = "date desc, move_name desc, id" # ==== Business fields ==== move_id = fields.Many2one('account.move', string='Journal Entry', index=True, required=True, auto_join=True, ondelete="cascade", help="The move of this entry line.") move_name = fields.Char(string='Number', related='move_id.name', store=True, index=True) - date = fields.Date(related='move_id.date', store=True, readonly=True, index=True, copy=False) + date = fields.Date(related='move_id.date', store=True, readonly=True, index=True, copy=False, group_operator='min') ref = fields.Char(related='move_id.ref', store=True, copy=False, index=True, readonly=False) parent_state = fields.Selection(related='move_id.state', store=True, readonly=True) journal_id = fields.Many2one(related='move_id.journal_id', store=True, readonly=False, index=True, copy=False) diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index a244fca68bc..17dff24eab6 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -649,7 +649,7 @@ widget="section_and_note_one2many" mode="tree,kanban" context="{'journal_id': journal_id, 'default_partner_id': commercial_partner_id, 'default_currency_id': currency_id != company_currency_id and currency_id or False}"> - + @@ -658,8 +658,9 @@ + - + + @@ -738,7 +740,7 @@ - + + + diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml index 1dc438806af..3f879df6da3 100644 --- a/addons/account/views/account_payment_view.xml +++ b/addons/account/views/account_payment_view.xml @@ -195,6 +195,7 @@ +