diff --git a/account.py b/account.py index d378b91ab7..e82f67af8e 100644 --- a/account.py +++ b/account.py @@ -345,15 +345,9 @@ class OpenChartAccount(Wizard): def _action_open_chart(self, cursor, user, data, context=None): model_data_obj = self.pool.get('ir.model.data') act_window_obj = self.pool.get('ir.action.act_window') - - model_data_ids = model_data_obj.search(cursor, user, [ - ('fs_id', '=', 'act_account_tree2'), - ('module', '=', 'analytic_account'), - ('inherit', '=', False), - ], limit=1, context=context) - model_data = model_data_obj.browse(cursor, user, model_data_ids[0], - context=context) - res = act_window_obj.read(cursor, user, model_data.db_id, context=context) + act_window_id = model_data_obj.get_id(cursor, user, 'analytic_account', + 'act_account_tree2', context=context) + res = act_window_obj.read(cursor, user, act_window_id, context=context) res['pyson_context'] = PYSONEncoder().encode({ 'start_date': data['form']['start_date'], 'end_date': data['form']['end_date'], diff --git a/line.py b/line.py index 66bb9eae37..c4fe848a21 100644 --- a/line.py +++ b/line.py @@ -154,14 +154,9 @@ class OpenAccount(Wizard): if context is None: context = {} - model_data_ids = model_data_obj.search(cursor, user, [ - ('fs_id', '=', 'act_line_form'), - ('module', '=', 'analytic_account'), - ('inherit', '=', False), - ], limit=1, context=context) - model_data = model_data_obj.browse(cursor, user, model_data_ids[0], - context=context) - res = act_window_obj.read(cursor, user, model_data.db_id, context=context) + act_window_id = model_data_obj.get_id(cursor, user, 'analytic_account', + 'act_line_form', context=context) + res = act_window_obj.read(cursor, user, act_window_id, context=context) res['pyson_domain'] = [ ('account', '=', data['id']), ]