1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
6 # $Id: __terp__.py 8595 2008-06-16 13:00:21Z stw $
8 # WARNING: This program as such is intended to be used by professional
9 # programmers who take the whole responsability of assessing all potential
10 # consequences resulting from its eventual inadequacies and bugs
11 # End users who are looking for a ready-to-use solution with commercial
12 # garantees and support are strongly adviced to contract a Free Software
15 # This program is Free Software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License
17 # as published by the Free Software Foundation; either version 2
18 # of the License, or (at your option) any later version.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 ###############################################################################
30 from osv import fields, osv
33 ##class config_install_extra_modules(osv.osv_memory):
34 ## _name='config.install_extra_modules'
35 ## def _get_uninstall_modules(self,cr,uid,context=None):
36 ## module_obj=self.pool.get('ir.module.module')
37 ## line_obj=self.pool.get('config.install_extra_modules.line')
38 ## uninstall_module_ids=module_obj.search(cr,uid,[('state', 'in', ['uninstalled', 'uninstallable'])])
40 ## for id in uninstall_module_ids:
41 ## res.append(line_obj.create(cr,uid,{'module_id':id},context=None))
45 ## 'name':fields.char('Name', size=64),
46 ## 'module_ids':fields.one2many('config.install_extra_modules.line', 'config_id', 'Modules'),
50 ## 'module_ids':_get_uninstall_modules
52 ## def action_install(self, cr, uid, ids, context=None):
53 ## res=self.read(cr,uid,ids)[0]
54 ## mod_obj = self.pool.get('ir.module.module')
55 ## line_obj=self.pool.get('config.install_extra_modules.line')
56 ## if 'module_ids' in res:
57 ## module_ids=res['module_ids']
58 ## lines=line_obj.read(cr,uid,module_ids)
60 ## if 'install' in line and 'module_id' and line and line['install']:
61 ## mod_obj.download(cr, uid, [line['module_id']], context=context)
63 ## db, pool = pooler.restart_pool(cr.dbname, update_module=True)
65 ## 'view_type': 'form',
66 ## "view_mode": 'form',
67 ## 'res_model': 'ir.module.module.configuration.wizard',
68 ## 'type': 'ir.actions.act_window',
72 ##config_install_extra_modules()
74 #class config_install_extra_modules_line(osv.osv_memory):
75 # _name='config.install_extra_modules.line'
77 # 'name':fields.char('Name', size=64),
78 # 'install':fields.boolean('Install'),
79 # 'config_id': fields.many2one('config.install_extra_modules', 'Configuration Module Wizard'),
80 # 'module_id':fields.many2one('ir.module.module', 'Module',readonly=True,required=True),
85 #config_install_extra_modules_line()
87 class config_install_extra_modules(osv.osv_memory):
88 _name='config.install_extra_modules'
90 'name':fields.char('Name', size=64),
91 'timesheets_module':fields.boolean('Timesheets Management'),
92 'holidays_module':fields.boolean('Hollidays Management'),
95 def action_cancel(self,cr,uid,ids,conect=None):
99 'res_model': 'ir.module.module.configuration.wizard',
100 'type': 'ir.actions.act_window',
103 def action_install(self, cr, uid, ids, context=None):
104 res=self.read(cr,uid,ids)[0]
105 mod_obj = self.pool.get('ir.module.module')
106 if 'timesheets_module' in res and res['timesheets_module']:
107 ids = mod_obj.search(cr, uid, [('name', '=', 'hr_timesheet')])
108 mod_obj.download(cr, uid, ids, context=context)
110 #db, pool = pooler.restart_pool(cr.dbname, update_module=True)
111 if 'hr_holidays_module' in res and res['hr_holidays_module']:
112 ids = mod_obj.search(cr, uid, [('name', '=', 'hr_holidays')])
113 mod_obj.download(cr, uid, ids, context=context)
115 #db, pool = pooler.restart_pool(cr.dbname, update_module=True)
119 'res_model': 'ir.module.module.configuration.wizard',
120 'type': 'ir.actions.act_window',
124 config_install_extra_modules()
126 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: