merge
[odoo/odoo.git] / addons / association / profile_association.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 from lxml import etree
22 from osv import fields, osv
23
24 class profile_association_config_install_modules_wizard(osv.osv_memory):
25     _inherit = 'base.setup.installer'
26
27     _columns = {
28         'hr_expense':fields.boolean('Resources Management: Expenses Tracking',  help="Tracks and manages employee expenses, and can "
29                  "automatically re-invoice clients if the expenses are "
30                  "project-related."),
31         'event_project':fields.boolean('Event Management: Events', help="Helps you to manage and organize your events."),
32         'project_gtd':fields.boolean('Getting Things Done',
33             help="GTD is a methodology to efficiently organise yourself and your tasks. This module fully integrates GTD principle with OpenERP's project management."),
34         'wiki': fields.boolean('Wiki', help="Lets you create wiki pages and page groups in order "
35                  "to keep track of business knowledge and share it with "
36                  "and  between your employees."),
37     }
38
39     # Will be removed when rd-v61-al-config-depends will be done
40     def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
41         res = super(profile_association_config_install_modules_wizard, self).fields_view_get(cr, user, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
42         doc = etree.XML(res['arch'])
43         for module in ['project_gtd','hr_expense']:
44             count = 0
45             for node in doc.xpath("//field[@name='%s']" % (module)):
46                 count = count + 1
47                 if count > 1:
48                     node.set('invisible', '1')
49         res['arch'] = etree.tostring(doc)
50         return res
51    
52 profile_association_config_install_modules_wizard()
53 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: