From 14879c262316d8d3ed77c9db0a08a04803bdff52 Mon Sep 17 00:00:00 2001 From: "Thomas Becquevort (thbe)" Date: Fri, 27 Oct 2023 10:27:19 +0200 Subject: [PATCH] [IMP] account: Splitting Amount to settle menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the "Amounts to settle" button in the "Vendors" drop-down menu opens a view showing all the account.move.line that are to be reconciled. Also, they should only be shown when their residual is less than zero. This commit makes it now so that when clicking on that button, only the amls linked to a purchase journal are shown and another "Amounts to Settle" button has been added in the "Customers" drop-down menu to show the amls linked to a sale journal task-3572482 closes odoo/odoo#140040 Signed-off-by: William André (wan) --- .../models/account_journal_dashboard.py | 6 ++++-- addons/account/views/account_menuitem.xml | 1 + addons/account/views/account_move_views.xml | 21 +++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 158563b7ae6..e8d89e0f02e 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -565,8 +565,9 @@ class account_journal(models.Model): ('journal_id', 'in', self.ids), ('move_id.payment_state', 'in', ('not_paid', 'partial')), ('date_maturity', '!=', False), - ('amount_residual', '!=', False), + ('amount_residual', '<', 0), ('parent_state', '=', 'posted'), + ('journal_id.type', '=', 'purchase'), ]) def _get_late_payment_query(self): @@ -575,8 +576,9 @@ class account_journal(models.Model): ('journal_id', 'in', self.ids), ('move_id.payment_state', 'in', ('not_paid', 'partial')), ('date_maturity', '<', fields.Date.context_today(self)), - ('amount_residual', '!=', False), + ('amount_residual', '<', 0), ('parent_state', '=', 'posted'), + ('journal_id.type', '=', 'purchase'), ]) def _count_results_and_sum_amounts(self, results_dict, target_currency): diff --git a/addons/account/views/account_menuitem.xml b/addons/account/views/account_menuitem.xml index c1f49e05843..31aecc8ae63 100644 --- a/addons/account/views/account_menuitem.xml +++ b/addons/account/views/account_menuitem.xml @@ -11,6 +11,7 @@ + diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 57d903179e2..9c568d72416 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -1690,6 +1690,23 @@ + + Customer Amounts to Settle + account.move.line + tree + + + {'search_default_group_by_partner':1, 'expand':1} + [('parent_state', '=', 'posted'), ('amount_residual', '<', 0), ('account_id.reconcile', '=', True), ('journal_id.type', '=', 'sale')] + +

+ Amounts to settle +

+ Cool, it looks like you don't have any customer credit notes to pay. +

+
+
+ Amounts to Settle account.move.line @@ -1697,12 +1714,12 @@ {'search_default_group_by_partner':1, 'expand':1} - [('parent_state', '=', 'posted'), ('amount_residual', '!=', 0), ('account_id.reconcile', '=', True)] + [('parent_state', '=', 'posted'), ('amount_residual', '<', 0), ('account_id.reconcile', '=', True), ('journal_id.type', '=', 'purchase')]

Amounts to settle

- Cool, it looks like you don't have anything to pay either for vendor bills or for customer credit notes. + Cool, it looks like you don't have any vendor bills to pay.