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 osv import fields, osv
23 class base_setup_installer(osv.osv_memory):
24 _name = 'base.setup.installer'
25 _inherit = 'res.config.installer'
28 ('sale','crm'): ['sale_crm'],
29 ('sale','project'): ['project_mrp'],
33 'crm':fields.boolean('Customer Relationship Management',
34 help="Helps you track and manage relations with customers such as"
35 " leads, requests or issues. Can automatically send "
36 "reminders, escalate requests or trigger business-specific "
37 "actions based on standard events."),
38 'sale':fields.boolean('Sales Management',
39 help="Helps you handle your quotations, sale orders and invoicing"
41 'project':fields.boolean('Project Management',
42 help="Helps you manage your projects and tasks by tracking them, "
43 "generating plannings, etc..."),
44 'knowledge':fields.boolean('Knowledge Management',
45 help="Lets you install addons geared towards sharing knowledge "
46 "with and between your employees."),
47 'stock':fields.boolean('Warehouse Management',
48 help="Helps you manage your inventory and main stock operations: delivery orders, receptions, etc."),
49 'mrp':fields.boolean('Manufacturing',
50 help="Helps you manage your manufacturing processes and generate "
51 "reports on those processes."),
52 'account_voucher':fields.boolean('Invoicing',
53 help="Allows you to create your invoices and track the payments. It is an easier version of the accounting module for managers who are not accountants."),
54 'account_accountant':fields.boolean('Accounting & Finance',
55 help="Helps you handle your accounting needs, if you are not an accountant, we suggest you to install only the Invoicing "),
56 'purchase':fields.boolean('Purchase Management',
57 help="Helps you manage your purchase-related processes such as "
58 "requests for quotations, supplier invoices, etc..."),
59 'hr':fields.boolean('Human Resources',
60 help="Helps you manage your human resources by encoding your employees structure, generating work sheets, tracking attendance and more."),
61 'point_of_sale':fields.boolean('Point of Sales',
62 help="Helps you get the most out of your points of sales with "
63 "fast sale encoding, simplified payment mode encoding, "
64 "automatic picking lists generation and more."),
65 'marketing':fields.boolean('Marketing',
66 help="Helps you manage your marketing campaigns step by step."),
67 'profile_tools':fields.boolean('Extra Tools',
68 help="Lets you install various interesting but non-essential tools "
69 "like Survey, Lunch and Ideas box."),
70 'report_designer':fields.boolean('Advanced Reporting',
71 help="Lets you install various tools to simplify and enhance "
72 "OpenERP's report creation."),
74 'product_expiry':fields.boolean('Food Industry',
75 help="Installs a preselected set of OpenERP applications "
76 "which will help you manage your industry."),
77 'association':fields.boolean('Associations',
78 help="Installs a preselected set of OpenERP "
79 "applications which will help you manage your association "
81 'auction':fields.boolean('Auction Houses',
82 help="Installs a preselected set of OpenERP "
83 "applications selected to help you manage your auctions "
84 "as well as the business processes around them."),
87 def _if_knowledge(self, cr, uid, ids, context=None):
88 if self.pool.get('res.users').browse(cr, uid, uid, context=context)\
90 return ['document_ftp']
93 def _if_misc_tools(self, cr, uid, ids, context=None):
94 return ['profile_tools']
96 def onchange_moduleselection(self, cr, uid, ids, *args, **kargs):
99 closed, total = self.get_current_progress(cr, uid)
100 progress = round(100. * closed / (total + len(filter(None, args))))
101 value.update({'progress':progress})
105 return {'value':value}
108 def default_get(self, cr, uid, fields_list, context=None):
109 #Skipping default value as checked for main application, if already installed
110 return super(osv.osv_memory, self).default_get(
111 cr, uid, fields_list, context=context)
113 def fields_get(self, cr, uid, fields=None, context=None, write_access=True):
114 #Skipping readonly value for main application, if already installed
115 return super(osv.osv_memory, self).fields_get(
116 cr, uid, fields, context, write_access)
118 def execute(self, cr, uid, ids, context=None):
121 modules = self.pool.get('ir.module.module')
122 upgrade_obj = self.pool.get('base.module.upgrade')
123 modules_selected = []
124 datas = self.read(cr, uid, ids, context=context)[0]
127 key.remove("progress")
131 modules_selected.append(mod)
132 inst = modules.browse(
134 modules.search(cr, uid,
135 [('name','in',modules_selected)
140 if i.state == 'uninstalled':
142 modules.state_update(cr, uid, [sect_mod_id], 'to install', ['uninstalled'], context)
143 upgrade_obj.upgrade_module(cr, uid, [sect_mod_id], context=context)
144 elif i.state == 'installed':
146 for instl in modules_selected:
147 cr.execute("update ir_actions_todo set restart='on_trigger' , state='open' from ir_model_data as data where data.res_id = ir_actions_todo.id and data.model = 'ir.actions.todo' and data.module like '%"+instl+"%'")
150 base_setup_installer()