From 910e5de42d8dc880e5d9261f516cf8ddb429ff24 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 22 May 2019 09:27:33 +0000 Subject: [PATCH] [FIX] account: open from dashboard In the accounting dashboard, click on the hamburger menu of a purchase or sales journal, then click on View Bills. Both vendor bills and refunds are displayed. This is because the `use_domain` key of the view is replaced in the `open_action` method. opw-2000904 closes odoo/odoo#33562 Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_journal_dashboard.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 3ade0b476b6..dc018b468f1 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -4,6 +4,7 @@ from datetime import datetime, timedelta from babel.dates import format_datetime, format_date from odoo import models, api, _, fields +from odoo.osv import expression from odoo.release import version from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF, safe_eval from odoo.tools.misc import formatLang @@ -343,10 +344,16 @@ class account_journal(models.Model): action_name = 'action_view_bank_statement_tree' elif self.type == 'sale': action_name = 'action_invoice_tree1' - self = self.with_context(use_domain=[('journal_id', '=', self.id)]) + use_domain = expression.AND( + [self.env.context.get('use_domain', []), [('journal_id', '=', self.id)]] + ) + self = self.with_context(use_domain=use_domain) elif self.type == 'purchase': action_name = 'action_vendor_bill_template' - self = self.with_context(use_domain=[('journal_id', '=', self.id)]) + use_domain = expression.AND( + [self.env.context.get('use_domain', []), [('journal_id', '=', self.id)]] + ) + self = self.with_context(use_domain=use_domain) else: action_name = 'action_move_journal_line'