summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroco-odoo <oco@odoo.com>2019-09-26 11:48:47 +0000
committerwan <wan@odoo.com>2019-09-27 09:19:38 +0000
commitae2cbfa20f837ae1e6d66f880c0dada7f562af7f (patch)
tree087f0ce3c0213ed7db79c278e21eb0e2601b53ae
parent40f0c28d5efddfcc28b0a99d06254572bb458f3e (diff)
[FIX] account: make open_action() work with actions targetting both account.move and account.move.line
-rw-r--r--addons/account/models/account_journal_dashboard.py6
1 files 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