[IMP] access rights
[odoo/odoo.git] / addons / crm / crm_installer.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2004-2009 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 lxml import etree
23 from osv import fields, osv
24
25 class crm_installer(osv.osv_memory):
26     _name = 'crm.installer'
27     _inherit = 'res.config.installer'
28
29     _columns = {
30         'name': fields.char('Name', size=64),
31         'crm_helpdesk': fields.boolean('Helpdesk', help="Manages a Helpdesk service."),
32         'crm_fundraising': fields.boolean('Fundraising', help="This may help associations in their fundraising process and tracking."),
33         'crm_claim': fields.boolean('Claims', help="Manages the suppliers and customers claims, including your corrective or preventive actions."),
34         'crm_caldav': fields.boolean('Calendar Synchronizing', help="Helps you to synchronize the meetings with other calendar clients and mobiles."),
35         'sale_crm': fields.boolean('Opportunity to Quotation', help="This module relates sale from opportunity cases in the CRM."),
36         'fetchmail': fields.boolean('Fetch Emails', help="Allows you to receive E-Mails from POP/IMAP server."),
37         'thunderbird': fields.boolean('Thunderbird', help="Allows you to link your e-mail to OpenERP's documents. You can attach it to any existing one in OpenERP or create a new one."),
38         'outlook': fields.boolean('MS-Outlook', help="Allows you to link your e-mail to OpenERP's documents. You can attach it to any existing one in OpenERP or create a new one."),
39         'wiki_sale_faq': fields.boolean('Sale FAQ', help="Helps you manage wiki pages for Frequently Asked Questions on Sales Application."),
40     }
41
42     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
43         res = super(crm_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
44         #Checking sale module is installed or not
45         cr.execute("SELECT * from ir_module_module where state='installed' and name = 'sale'")
46         count = cr.fetchall()
47         if count:
48             doc = etree.XML(res['arch'])
49             nodes = doc.xpath("//field[@name='sale_crm']")
50             for node in nodes:
51                 node.set('invisible', '0')
52             res['arch'] = etree.tostring(doc)
53         return res
54
55 crm_installer()
56
57 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: