[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) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-05-22 09:42:47 +00:00
parent 9db8497a99
commit 910e5de42d
@@ -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'