Use get_id of ir.model.data

This commit is contained in:
Cédric Krier committed 2010-01-21 12:10:31 +01:00
1 parent 4bdf51feca
commit ebc5d1835f
2 files changed
+15 -44

No files matched your search

+6 -18
View File
@@ -113,15 +113,9 @@ class EnterLines(Wizard):
model_data_obj = self.pool.get('ir.model.data')
act_window_obj = self.pool.get('ir.action.act_window')
employee_obj = self.pool.get('company.employee')
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_line_form'),
('module', '=', 'timesheet'),
('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, 'timesheet',
'act_line_form', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
date = data['form']['date']
date = Date(date.year, date.month, date.day)
res['pyson_domain'] = PYSONEncoder().encode([
@@ -213,15 +207,9 @@ class OpenHoursEmployee(Wizard):
def _action_open(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_hours_employee_form'),
('module', '=', 'timesheet'),
('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, 'timesheet',
'act_hours_employee_form', 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'],
+9 -26
View File
@@ -167,15 +167,9 @@ class OpenWork(Wizard):
def _action_open_work(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_work_tree2'),
('module', '=', 'timesheet'),
('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, 'timesheet',
'act_work_tree2', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
res['pyson_context'] = PYSONEncoder().encode({
'from_date': data['form']['from_date'],
'to_date': data['form']['to_date'],
@@ -191,15 +185,9 @@ class OpenWork2(OpenWork):
def _action_open_work(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_work_form2'),
('module', '=', 'timesheet'),
('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, 'timesheet',
'act_work_form2', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
res['pyson_context'] = PYSONEncoder().encode({
'from_date': data['form']['from_date'],
'to_date': data['form']['to_date'],
@@ -229,14 +217,9 @@ class OpenWorkGraph(Wizard):
if context is None:
context = {}
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_work_form3'),
('module', '=', 'timesheet'),
('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, 'timesheet',
'act_work_form3', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
if 'active_id' in context:
work = work_obj.browse(cursor, user, context['active_id'],
context=context)