~openerp-groupes/openobject-server/6.0-fix-setup-windows

« back to all changes in this revision

Viewing changes to bin/addons/base/module/wizard/wizard_install_module.py

  • Committer: pinky
  • Date: 2006-12-07 13:41:40 UTC
  • Revision ID: pinky-3f10ee12cea3c4c75cef44ab04ad33ef47432907
New trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: iso-8859-1 -*-
 
2
##############################################################################
 
3
#
 
4
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
 
5
#
 
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
 
11
# Service Company
 
12
#
 
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.
 
17
#
 
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.
 
22
#
 
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.
 
26
#
 
27
##############################################################################
 
28
 
 
29
import wizard
 
30
import netsvc
 
31
 
 
32
#TODO: upgraded modules
 
33
#TODO: removed modules
 
34
additional_changes_form = '''<?xml version="1.0"?>
 
35
<form string="Additional modules">
 
36
        <label string="The following additional modules need to be installed:"/>
 
37
        <newline/>
 
38
        <field name="additional"/>
 
39
</form>'''
 
40
 
 
41
additional_changes_fields = {
 
42
        'additional': {'string':'Additional modules', 'type':'one2many', 'relation':'ir.module.module', 'readonly':True},
 
43
}
 
44
 
 
45
class wizard_install_module(wizard.interface):
 
46
        def _get_value(self, cr, uid, data, context):
 
47
                service = netsvc.LocalService("object_proxy")
 
48
                extra = service.execute(cr.dbname, uid, 'ir.module.module', 'get_extra_modules', data['ids'])
 
49
                return {'additional': extra}
 
50
 
 
51
        def _install_module(self, cr, uid, data, context):
 
52
                service = netsvc.LocalService("object_proxy")
 
53
                res = service.execute(cr.dbname, uid, 'ir.module.module', 'install', data['ids'])
 
54
                return {}
 
55
 
 
56
        states = {
 
57
                'init': {
 
58
                        'actions': [_get_value], 
 
59
                        'result': {'type':'form', 'arch':additional_changes_form, 'fields':additional_changes_fields, 'state':[('install','Install'), ('end','Cancel')]}
 
60
                },
 
61
                'install': {
 
62
                        'actions': [_install_module],
 
63
                        'result': {'type':'state', 'state':'end'}
 
64
                },
 
65
        }
 
66
wizard_install_module('module.module.install')
 
67