[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
This commit is contained in:
Richard deMeester
2016-10-12 10:28:16 +02:00
committed by Martin Trigaux
parent d30f512128
commit 32b0e9520d
2 changed files with 3 additions and 3 deletions
@@ -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)]
@@ -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