From ae2cbfa20f837ae1e6d66f880c0dada7f562af7f Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Thu, 26 Sep 2019 11:48:47 +0000 Subject: [PATCH] [FIX] account: make open_action() work with actions targetting both account.move and account.move.line --- addons/account/models/account_journal_dashboard.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 3036ae7aed3..629ad917748 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -494,10 +494,12 @@ class account_journal(models.Model): 'search_default_journal_id': self.id, }) + domain_type_field = action['res_model'] == 'account.move.line' and 'move_id.type' or 'type' # The model can be either account.move or account.move.line + if self.type == 'sale': - action['domain'] = [('move_id.type', 'in', ('out_invoice', 'out_refund', 'out_receipt'))] + action['domain'] = [(domain_type_field, 'in', ('out_invoice', 'out_refund', 'out_receipt'))] elif self.type == 'purchase': - action['domain'] = [('move_id.type', 'in', ('in_invoice', 'in_refund', 'in_receipt'))] + action['domain'] = [(domain_type_field, 'in', ('in_invoice', 'in_refund', 'in_receipt'))] return action