From 32b0e9520ddc641c5bbbec835731822fb86eafb2 Mon Sep 17 00:00:00 2001 From: Richard deMeester <richard@willowit.com.au> Date: Wed, 5 Oct 2016 10:30:38 +1100 Subject: [PATCH] [FIX[ account: correct 'read' call Using the read method should generally pass a single id as a list due to the new API inheritance of the read method. If an attempt is made to use the new API, the result is inconsistent. Following 4f0ca6d9 Closes #13678 --- addons/account/models/account_journal_dashboard.py | 4 ++-- addons/account_bank_statement_import/account_journal.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index b1bf44aa4ae0..8fc73d1a3caf 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -313,7 +313,7 @@ class account_journal(models.Model): }) 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) + action = self.pool[model].read(self._cr, self._uid, [action_id], context=self._context)[0] action['context'] = ctx action['domain'] = self._context.get('use_domain', []) return action @@ -356,7 +356,7 @@ class account_journal(models.Model): 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) + action = self.pool[model].read(self._cr, self._uid, [action_id], context=self._context)[0] action['context'] = ctx if ctx.get('use_domain', False): action['domain'] = ['|', ('journal_id', '=', self.id), ('journal_id', '=', False)] diff --git a/addons/account_bank_statement_import/account_journal.py b/addons/account_bank_statement_import/account_journal.py index 7964ecc9aec2..eac0cdb71f29 100644 --- a/addons/account_bank_statement_import/account_journal.py +++ b/addons/account_bank_statement_import/account_journal.py @@ -14,7 +14,7 @@ class AccountJournal(models.Model): action_name = 'action_account_bank_statement_import' ir_model_obj = self.pool['ir.model.data'] model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account_bank_statement_import', action_name) - action = self.pool[model].read(self._cr, self._uid, action_id, context=self.env.context) + action = self.pool[model].read(self._cr, self._uid, [action_id], context=self.env.context)[0] # Note: this drops action['context'], which is a dict stored as a string, which is not easy to update action.update({'context': (u"{'journal_id': " + str(self.id) + u"}")}) return action -- GitLab