1
##############################################################################
3
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
4
# Fabien Pinckaers <fp@tiny.Be>
6
# WARNING: This program as such is intended to be used by professional
7
# programmers who take the whole responsability of assessing all potential
8
# consequences resulting from its eventual inadequacies and bugs
9
# End users who are looking for a ready-to-use solution with commercial
10
# garantees and support are strongly adviced to contract a Free Software
13
# This program is Free Software; you can redistribute it and/or
14
# modify it under the terms of the GNU General Public License
15
# as published by the Free Software Foundation; either version 2
16
# of the License, or (at your option) any later version.
18
# This program is distributed in the hope that it will be useful,
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
# GNU General Public License for more details.
23
# You should have received a copy of the GNU General Public License
24
# along with this program; if not, write to the Free Software
25
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
##############################################################################
36
class window_int(object):
37
def __init__(self, view, datas):
38
self.name = datas.get('name', _('Unknown Window'))
40
class window(service.Service):
41
def __init__(self, name='gui.window'):
42
service.Service.__init__(self, name)
43
def create(self, view_id, model, res_id=False, domain=None, view_type='form', window=None, context={}, mode=None):
44
context.update(rpc.session.context)
46
mode = (mode or 'form,tree').split(',')
47
win = form.form(model, res_id, domain, view_type=mode, view_ids = (view_id and [view_id]) or [], window=window, context=context)
48
spool = service.LocalService('spool')
49
spool.publish('gui.window', win, {})
50
elif view_type=='tree':
52
view_base = rpc.session.rpc_exec_auth('/object', 'execute', 'ir.ui.view', 'read', [view_id], ['model', 'type'], context)[0]
53
model = view_base['model']
54
view = rpc.session.rpc_exec_auth('/object', 'execute', view_base['model'], 'fields_view_get', view_id, view_base['type'],context)
56
view = rpc.session.rpc_exec_auth('/object', 'execute', model, 'fields_view_get', False, view_type, context)
58
win = tree.tree(view, model, res_id, domain, context)
59
spool = service.LocalService('spool')
60
spool.publish('gui.window', win, {})
63
log = logging.getLogger('view')
64
log.error('unknown view type: '+str(view['type']))