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