bugfix
[odoo/odoo.git] / addons / profile_accounting / profile_accounting.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 class profile_accounting_config_install_modules_wizard(osv.osv_memory):
27     _name='profile.accounting.config.install_modules_wizard'
28     _columns = {
29         'name':fields.char('Name', size=64),
30         'account_analytic_analysis':fields.boolean('Analytic Accounting'),
31         'account_analytic_plans':fields.boolean('Multiple Analytic Plans'),
32         'account_payment':fields.boolean('Suppliers Payment Management'),
33         'account_asset':fields.boolean('Asset Management'),
34         'hr_timesheet_invoice':fields.boolean('Invoice on Analytic Entries'),
35         'account_budget':fields.boolean('Budgets', help="Helps you to manage financial and analytic budgets."),
36         '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."),
37
38
39     }
40     def action_cancel(self,cr,uid,ids,conect=None):
41         return {
42                 'view_type': 'form',
43                 "view_mode": 'form',
44                 'res_model': 'ir.actions.configuration.wizard',
45                 'type': 'ir.actions.act_window',
46                 'target':'new',
47          }
48
49
50     def action_install(self, cr, uid, ids, context=None):
51         result=self.read(cr,uid,ids)
52         mod_obj = self.pool.get('ir.module.module')
53         for res in result:
54             for r in res:
55                 if r<>'id' and res[r]:
56                     ids += mod_obj.search(cr, uid, [('name', '=', r)])
57                     mod_obj.action_install(cr, uid, ids, context=context)
58         cr.commit()
59         db, pool = pooler.restart_pool(cr.dbname,update_module=True)
60         return {
61                 'view_type': 'form',
62                 "view_mode": 'form',
63                 'res_model': 'ir.actions.configuration.wizard',
64                 'type': 'ir.actions.act_window',
65                 'target':'new',
66             }
67
68
69 profile_accounting_config_install_modules_wizard()
70
71 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
72