Skip to content

Commit 32b0e95

Browse files
Richard deMeestermart-e
Richard deMeester
authored andcommitted
[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 4f0ca6d Closes odoo#13678
1 parent d30f512 commit 32b0e95

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

addons/account/models/account_journal_dashboard.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def open_action(self):
313313
})
314314
ir_model_obj = self.pool['ir.model.data']
315315
model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name)
316-
action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context)
316+
action = self.pool[model].read(self._cr, self._uid, [action_id], context=self._context)[0]
317317
action['context'] = ctx
318318
action['domain'] = self._context.get('use_domain', [])
319319
return action
@@ -356,7 +356,7 @@ def open_action_with_context(self):
356356
ctx.pop('group_by', None)
357357
ir_model_obj = self.pool['ir.model.data']
358358
model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name)
359-
action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context)
359+
action = self.pool[model].read(self._cr, self._uid, [action_id], context=self._context)[0]
360360
action['context'] = ctx
361361
if ctx.get('use_domain', False):
362362
action['domain'] = ['|', ('journal_id', '=', self.id), ('journal_id', '=', False)]

addons/account_bank_statement_import/account_journal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def import_statement(self):
1414
action_name = 'action_account_bank_statement_import'
1515
ir_model_obj = self.pool['ir.model.data']
1616
model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account_bank_statement_import', action_name)
17-
action = self.pool[model].read(self._cr, self._uid, action_id, context=self.env.context)
17+
action = self.pool[model].read(self._cr, self._uid, [action_id], context=self.env.context)[0]
1818
# Note: this drops action['context'], which is a dict stored as a string, which is not easy to update
1919
action.update({'context': (u"{'journal_id': " + str(self.id) + u"}")})
2020
return action

0 commit comments

Comments
 (0)