Use get_id of ir.model.data

This commit is contained in:
Cédric Krier committed 2010-01-21 12:08:03 +01:00
1 parent 925df2127b
commit 9a726504ca
3 files changed
+23 -68

No files matched your search

+8 -24
View File
@@ -1125,15 +1125,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', '=', '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, 'account',
'act_account_tree2', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
res['pyson_context'] = PYSONEncoder().encode({
'fiscalyear': data['form']['fiscalyear'],
'posted': data['form']['posted'],
@@ -1598,14 +1592,9 @@ class OpenBalanceSheet(Wizard):
date = lang_obj.strftime(datas['form']['date'], lang.code, lang.date)
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_account_balance_sheet_tree'),
('module', '=', '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, 'account',
'act_account_balance_sheet_tree', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
res['pyson_context'] = PYSONEncoder().encode({
'date': Date(datas['form']['date'].year,
datas['form']['date'].month,
@@ -1728,13 +1717,8 @@ class OpenIncomeStatement(Wizard):
end_period_ids = list(set(end_period_ids).difference(
set(start_period_ids)))
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_account_income_statement_tree'),
('module', '=', 'account'),
('inherit', '=', False),
], limit=1, context=context)
model_data = model_data_obj.browse(cursor, user, model_data_ids[0],
context=context)
act_window_id = model_data_obj.get_id(cursor, user, 'account',
'act_account_income_statement_tree', context=context)
res = act_window_obj.read(cursor, user, model_data.db_id, context=context)
res['pyson_context'] = PYSONEncoder().encode({
'periods': end_period_ids,
+9 -25
View File
@@ -1451,14 +1451,9 @@ class OpenJournal(Wizard):
'period': period.id,
}, context=context)
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_move_line_form'),
('module', '=', '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, 'account',
'act_move_line_form', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
# Remove name to use the one from view_header_get
del res['name']
res['pyson_domain'] = PYSONEncoder().encode([
@@ -1507,14 +1502,9 @@ class OpenAccount(Wizard):
for period in fiscalyear.periods:
period_ids.append(period.id)
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_move_line_form'),
('module', '=', '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, 'account',
'act_move_line_form', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
res['pyson_domain'] = [
('period', 'in', period_ids),
('account', '=', data['id']),
@@ -1692,15 +1682,9 @@ class OpenReconcileLines(Wizard):
def _action_open_reconcile_lines(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_move_line_form'),
('module', '=', '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, 'account',
'act_move_line_form', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
res['pyson_domain'] = PYSONEncoder().encode([
('account', '=', data['form']['account']),
('reconciliation', '=', False),
+6 -19
View File
@@ -366,16 +366,9 @@ class OpenChartCode(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_tax_code_tree2'),
('module', '=', '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, 'account',
'act_tax_code_tree2', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
if data['form']['method'] == 'fiscalyear':
res['pyson_context'] = PYSONEncoder().encode({
'fiscalyear': data['form']['fiscalyear'],
@@ -1399,15 +1392,9 @@ class OpenCode(Wizard):
else:
period_ids = context['periods']
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_tax_line_form'),
('module', '=', '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, 'account',
'act_tax_line_form', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
res['pyson_domain'] = PYSONEncoder().encode([
('move_line.period', 'in', period_ids),
('code', '=', data['id']),