[MERGE]: Merge with lp:~openerp-dev/openobject-addons/uco-dev-configuration-wizards...
[odoo/odoo.git] / addons / base_setup / 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 from osv import fields, osv
22 import netsvc
23
24 class base_setup_installer(osv.osv_memory):
25     _name = 'base.setup.installer'
26     _inherit = 'res.config.installer'
27
28     _install_if = {
29         ('sale','crm'): ['sale_crm'],
30         ('sale','project'): ['project_mrp'],
31         ('sale',):['account_accountant']
32         }
33     _columns = {
34         # Generic modules
35         'crm':fields.boolean('Customer Relationship Management',
36             help="Helps you track and manage relations with customers such as"
37                  " leads, requests or issues. Can automatically send "
38                  "reminders, escalate requests or trigger business-specific "
39                  "actions based on standard events."),
40         'sale':fields.boolean('Sales Management',
41             help="Helps you handle your quotations, sale orders and invoicing"
42                  "."),
43         'project':fields.boolean('Project Management',
44             help="Helps you manage your projects and tasks by tracking them, "
45                  "generating plannings, etc..."),
46         'knowledge':fields.boolean('Knowledge Management',
47             help="Lets you install addons geared towards sharing knowledge "
48                  "with and between your employees."),
49         'stock':fields.boolean('Warehouse Management',
50             help="Helps you manage your stocks and stocks locations, as well "
51                  "as the flow of stock between warehouses."),
52         'mrp':fields.boolean('Manufacturing',
53             help="Helps you manage your manufacturing processes and generate "
54                  "reports on those processes."),
55         'account':fields.boolean('Financial & Accounting',
56             help="Helps you handle your accounting needs, as well as create "
57                  "and track your budgets."),
58         'purchase':fields.boolean('Purchase Management',
59             help="Helps you manage your purchase-related processes such as "
60                  "requests for quotations, supplier invoices, etc..."),
61         'hr':fields.boolean('Human Resources',
62             help="Helps you manage your human resources by encoding your employees structure, generating work sheets, tracking attendance and more"),
63         'point_of_sale':fields.boolean('Point of Sales',
64             help="Helps you get the most out of your points of sales with "
65                  "fast sale encoding, simplified payment mode encoding, "
66                  "automatic picking lists generation and more."),
67         'marketing':fields.boolean('Marketing',
68             help="Helps you manage your marketing campaigns step by step."),
69         'profile_tools':fields.boolean('Miscellaneous Tools',
70             help="Lets you install various interesting but non-essential tools "
71                 "like Survey, Lunch and Ideas box."),
72         'report_designer':fields.boolean('Advanced Reporting',
73             help="Lets you install various tools to simplify and enhance "
74                  "OpenERP's report creation."),
75         'thunderbird' :fields.boolean('Thunderbird'),
76         # Vertical modules
77         'product_expiry':fields.boolean('Food Industry',
78             help="Installs a preselected set of OpenERP applications "
79                 "which will help you manage your industry"),
80         'association':fields.boolean('Associations',
81             help="Installs a preselected set of OpenERP "
82                  "applications which will help you manage your association "
83                  "more efficiently."),
84         'auction':fields.boolean('Auction Houses',
85             help="Installs a preselected set of OpenERP "
86                  "applications selected to help you manage your auctions "
87                  "as well as the business processes around them."),
88         }
89     _defaults = {
90         'crm': True,
91         }
92
93     def _if_mrp(self, cr, uid, ids, context=None):
94         if self.pool.get('res.users').browse(cr, uid, uid, context=context)\
95                .view == 'simple':
96             return ['mrp_jit']
97         return None
98
99     def _if_knowledge(self, cr, uid, ids, context=None):
100         if self.pool.get('res.users').browse(cr, uid, uid, context=context)\
101                .view == 'simple':
102             return ['document_ftp']
103         return None
104
105     def onchange_moduleselection(self, cr, uid, ids, *args):
106         closed, total = self.get_current_progress(cr, uid)
107
108         progress = round(100. * closed / (total + len(filter(None, args))))
109         if progress < 10.:
110             progress = 10.
111         return {'value':{'progress':progress}}
112 base_setup_installer()