[MERGE]
[odoo/odoo.git] / addons / profile_accounting / profile_accounting.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #    
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU Affero General Public License as
9 #    published by the Free Software Foundation, either version 3 of the
10 #    License, or (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU Affero General Public License for more details.
16 #
17 #    You should have received a copy of the GNU Affero General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
19 #
20 ##############################################################################
21
22 from osv import fields, osv
23 import pooler
24
25 class profile_accounting_config_install_modules_wizard(osv.osv_memory):
26     _name='profile.accounting.config.install_modules_wizard'
27     _inherit = 'res.config'
28
29     _columns = {
30         'name':fields.char('Name', size=64),
31         'account_analytic_analysis':fields.boolean('Analytic Accounting'),
32         'account_analytic_plans':fields.boolean('Multiple Analytic Plans'),
33         'account_payment':fields.boolean('Suppliers Payment Management'),
34         'account_asset':fields.boolean('Asset Management'),
35         'hr_timesheet_invoice':fields.boolean('Invoice on Analytic Entries'),
36         'account_budget':fields.boolean('Budgets', help="Helps you to manage financial and analytic budgets."),
37         '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."),
38     }
39
40     def execute(self, cr, uid, ids, context=None):
41         result = self.read(cr, uid, ids)
42         mod_obj = self.pool.get('ir.module.module')
43         for res in result:
44             for r in res:
45                 if r != 'id' and res[r]:
46                     ids += mod_obj.search(cr, uid, [('name', '=', r)])
47                     mod_obj.button_install(cr, uid, ids, context=context)
48         cr.commit()
49         db, pool = pooler.restart_pool(cr.dbname, update_module=True)
50 profile_accounting_config_install_modules_wizard()
51
52 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
53