passing modules in GPL-3
[odoo/odoo.git] / addons / profile_association / profile_association.py
1 # -*- encoding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution   
5 #    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6 #    $Id$
7 #
8 #    This program is free software: you can redistribute it and/or modify
9 #    it under the terms of the GNU General Public License as published by
10 #    the Free Software Foundation, either version 3 of the License, or
11 #    (at your option) any later version.
12 #
13 #    This program is distributed in the hope that it will be useful,
14 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #    GNU General Public License for more details.
17 #
18 #    You should have received a copy of the GNU General Public License
19 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 #
21 ##############################################################################
22
23 from osv import fields, osv
24 import pooler
25
26
27 class profile_association_config_install_modules_wizard(osv.osv_memory):
28     _name='profile.association.config.install_modules_wizard'
29     _columns = {
30         'hr_expense':fields.boolean('Expenses Tracking', help="Tracks the personal expenses process, from the employee expense encoding, to the reimbursement of the employee up to the reinvoicing to the final customer."),
31         'project':fields.boolean('Project Management'),
32         'board_document':fields.boolean('Document Management', help= "The Document Management System of Open ERP allows you to store, browse, automatically index, search and preview all kind of documents (internal documents, printed reports, calendar system). It opens an FTP access for the users to easily browse association's document."),
33         'segmentation':fields.boolean('Segmentation'),
34         'crm_configuration' : fields.boolean('Partner Relation & Calendars'),
35         'project_gtd':fields.boolean('Getting Things Done', help="GTD is a methodology to efficiently organise yourself and your tasks. This module fully integrates GTD principle with OpenERP's project management."),
36     }
37     def action_cancel(self,cr,uid,ids,conect=None):
38         return {
39                 'view_type': 'form',
40                 "view_mode": 'form',
41                 'res_model': 'ir.actions.configuration.wizard',
42                 'type': 'ir.actions.act_window',
43                 'target':'new',
44          }
45     def action_install(self, cr, uid, ids, context=None):
46         result=self.read(cr,uid,ids)
47         mod_obj = self.pool.get('ir.module.module')
48         for res in result:
49             for r in res:
50                 if r<>'id' and res[r]:
51                     ids = mod_obj.search(cr, uid, [('name', '=', r)])
52                     mod_obj.action_install(cr, uid, ids, context=context)
53         cr.commit()
54         db, pool = pooler.restart_pool(cr.dbname, update_module=True)
55         return {
56                 'view_type': 'form',
57                 "view_mode": 'form',
58                 'res_model': 'ir.actions.configuration.wizard',
59                 'type': 'ir.actions.act_window',
60                 'target':'new',
61             }
62 profile_association_config_install_modules_wizard()