CLIENT,SERVER: switch default act_window to tree,form

bzr revid: ced-d0688044d73f6ed9754497b0497d0f4a1aaf77db
This commit is contained in:
ced
2007-05-25 13:54:46 +00:00
parent fafe1da318
commit 867f2fc877
2 changed files with 19 additions and 3 deletions
+11 -1
View File
@@ -111,6 +111,16 @@ class act_window(osv.osv):
res={}
for act in self.browse(cr, uid, ids):
res[act.id]=[(view.view_id.id, view.view_mode) for view in act.view_ids]
if (not act.view_ids) and act.view_id.id:
modes = act.view_mode.split(',')
if act.view_id.type <> modes[0]:
res[act.id].append((act.view_id.id, act.view_id.type))
find = False
for t in modes:
if t == act.view_id.type and not find:
find = True
continue
res[act.id].append((False, t))
return res
_columns = {
@@ -130,7 +140,7 @@ class act_window(osv.osv):
_defaults = {
'type': lambda *a: 'ir.actions.act_window',
'view_type': lambda *a: 'form',
'view_mode': lambda *a: 'form,tree',
'view_mode': lambda *a: 'tree,form',
'context': lambda *a: '{}'
}
act_window()
+8 -2
View File
@@ -251,8 +251,14 @@ class xml_import(object):
values['icon'] = icons.get(a_type,'STOCK_NEW')
if a_type=='act_window':
a_id = self.id_get(cr, 'ir.actions.%s'% a_type, a_action)
cr.execute('select view_type,view_mode,name from ir_act_window where id=%d', (int(a_id),))
action_type,action_mode,action_name = cr.fetchone()
cr.execute('select view_type,view_mode,name,view_id from ir_act_window where id=%d', (int(a_id),))
action_type,action_mode,action_name,view_id = cr.fetchone()
if view_id:
cr.execute('SELECT type FROM ir_ui_view WHERE id=%d', (int(view_id),))
action_mode, = cr.fetchone()
cr.execute('SELECT view_mode FROM ir_act_window_view WHERE view_id=%d ORDER BY sequence LIMIT 1', (int(a_id),))
if cr.rowcount:
action_mode, = cr.fetchone()
if action_type=='tree':
values['icon'] = 'STOCK_INDENT'
elif action_mode and action_mode.startswith('tree'):