From 4f037210c2436caaa57f13a210e605df899ba35a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 5 Aug 2016 14:52:44 +0200 Subject: [PATCH] [FIX] account: dashboard traceback In the dashboard view, it's possible to use the "Group By" feature. However, when clicking on a link on any dashboard, a traceback might show up. This is because the context key `group_by` is kept when clicking on an action. If the destination view is a list/kanban, and the destination model doesn't have the field, the system will try to make a grouping by a field which doesn't exist. The solution is to remove the `group_by` key from the context, since it doesn't make sense to send it the the destination model. opw-684568 --- addons/account/models/account_journal_dashboard.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 81ec2a97d1b..b1bf44aa4ae 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -303,6 +303,7 @@ class account_journal(models.Model): invoice_type = _journal_invoice_type_map[(self.type, self._context.get('invoice_type'))] ctx = self._context.copy() + ctx.pop('group_by', None) ctx.update({ 'journal_type': self.type, 'default_journal_id': self.id, @@ -336,6 +337,7 @@ class account_journal(models.Model): 'default_payment_type': payment_type, 'default_journal_id': self.id }) + ctx.pop('group_by', None) action_rec = self.env['ir.model.data'].xmlid_to_object('account.action_account_payments') if action_rec: action = action_rec.read([])[0] @@ -351,6 +353,7 @@ class account_journal(models.Model): ctx = dict(self.env.context, default_journal_id=self.id) if ctx.get('search_default_journal', False): ctx.update(search_default_journal_id=self.id) + ctx.pop('group_by', None) ir_model_obj = self.pool['ir.model.data'] model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name) action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context)