1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
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.
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.
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/>.
20 ##############################################################################
21 from operator import itemgetter
23 from osv import fields, osv
26 class account_installer(osv.osv_memory):
27 _name = 'account.installer'
28 _inherit = 'res.config.installer'
30 def _get_charts(self, cr, uid, context=None):
31 modules = self.pool.get('ir.module.module')
32 ids = modules.search(cr, uid, [('category_id','=','Account Charts')])
34 sorted(((m.name, m.shortdesc)
35 for m in modules.browse(cr, uid, ids)),
40 'charts':fields.selection(_get_charts, 'Chart of Accounts',
42 help="Installs localized accounting charts to match as closely as "
43 "possible the accounting needs of your company based on your "
45 'account_analytic_default':fields.boolean('Analytic Accounting',
46 help="Automatically selects analytic accounts based on various "
48 'account_analytic_plans':fields.boolean('Multiple Analytic Plans',
49 help="Allows invoice lines to impact multiple analytic accounts "
51 'account_payment':fields.boolean('Suppliers Payment Management',
52 help="Streamlines invoice payment and creates hooks to plug "
53 "automated payment systems in."),
54 'account_followup':fields.boolean('Followups Management',
55 help="Helps you generate reminder letters for unpaid invoices, "
56 "including multiple levels of reminding and customized "
57 "per-partner policies."),
58 'account_asset':fields.boolean('Assets Management',
59 help="Enables asset management in the accounting application, "
60 "including asset categories and usage periods.")
63 'account_analytic_default':True,
66 def modules_to_install(self, cr, uid, ids, context=None):
67 modules = super(account_installer, self).modules_to_install(
68 cr, uid, ids, context=context)
70 chart = self.read(cr, uid, ids, ['charts'],
71 context=context)[0]['charts']
72 self.logger.notifyChannel(
73 'installer', netsvc.LOG_DEBUG,
74 'Installing chart of accounts %s'%chart)
75 return modules | set([chart])