From 6ff823b2f635db8bb0fbcc4f7c17578335176d9e Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 23 Apr 2020 07:56:01 +0000 Subject: [PATCH] [FIX] account: dashboard domain - Go to Accounting - On Customer Invoices kanban card, click on the 3 dots > Credit Notes Invoices, credit notes and receipts are shown. This happens because the action domain is overridden, while it shouldn't be in this case. We only set the action domain if the action name was not explicitly requested. opw-2242195 closes odoo/odoo#50052 X-original-commit: 5dab4d56055cc197fb0f3a6cd20e60cd0f638fa9 Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_journal_dashboard.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 8c2134b4789..ff33c8db5de 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -470,10 +470,13 @@ class account_journal(models.Model): domain_type_field = action['res_model'] == 'account.move.line' and 'move_id.move_type' or 'move_type' # The model can be either account.move or account.move.line - if self.type == 'sale': - action['domain'] = [(domain_type_field, 'in', ('out_invoice', 'out_refund', 'out_receipt'))] - elif self.type == 'purchase': - action['domain'] = [(domain_type_field, 'in', ('in_invoice', 'in_refund', 'in_receipt'))] + # Override the domain only if the action was not explicitly specified in order to keep the + # original action domain. + if not self._context.get('action_name'): + if self.type == 'sale': + action['domain'] = [(domain_type_field, 'in', ('out_invoice', 'out_refund', 'out_receipt'))] + elif self.type == 'purchase': + action['domain'] = [(domain_type_field, 'in', ('in_invoice', 'in_refund', 'in_receipt'))] return action