cahnges in profiling
[odoo/odoo.git] / addons / crm_configuration / crm_config.py
1 # -*- encoding: utf-8 -*-
2 ##############################################################################
3 #
4 # Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
5 #
6 # $Id$
7 #
8 # WARNING: This program as such is intended to be used by professional
9 # programmers who take the whole responsability of assessing all potential
10 # consequences resulting from its eventual inadequacies and bugs
11 # End users who are looking for a ready-to-use solution with commercial
12 # garantees and support are strongly adviced to contract a Free Software
13 # Service Company
14 #
15 # This program is Free Software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License
17 # as published by the Free Software Foundation; either version 2
18 # of the License, or (at your option) any later version.
19 #
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28 #
29 ##############################################################################
30
31 import time
32 import tools
33 from osv import fields,osv,orm
34 import os
35 import mx.DateTime
36 import base64
37
38 #AVAILABLE_STATES = [
39 #    ('draft','Unreviewed'),
40 #    ('open','Open'),
41 #    ('cancel', 'Refuse Bug'),
42 #    ('done', 'Done'),
43 #    ('pending','Pending')
44 #]
45 class crm_case_category2(osv.osv):
46     _name = "crm.case.category2"
47     _description = "Category2 of case"
48     _rec_name = "name"
49     _columns = {
50         'name': fields.char('Case Category2 Name', size=64, required=True),
51         'section_id': fields.many2one('crm.case.section', 'Case Section'),
52     }
53 crm_case_category2()
54
55 class crm_case_stage(osv.osv):
56     _name = "crm.case.stage"
57     _description = "Stage of case"
58     _rec_name = 'name'
59     _columns = {
60         'name': fields.char('Stage Name', size=64, required=True),
61         'section_id': fields.many2one('crm.case.section', 'Case Section'),
62     }
63 crm_case_stage()
64
65 class crm_cases(osv.osv):
66     _name = "crm.case"
67     _inherit = "crm.case"
68     _columns = {
69         'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id)]"),
70         'category2_id': fields.many2one('crm.case.category2','Category Name', domain="[('section_id','=',section_id)]"),
71         'duration': fields.float('Duration'),
72         'note': fields.text('Note'),
73         'partner_name': fields.char('Employee Name', size=64),
74         'partner_name2': fields.char('Employee Email', size=64),
75         'partner_phone': fields.char('Phone', size=16),
76         'partner_mobile': fields.char('Mobile', size=16),
77     }
78
79 crm_cases()
80
81 class crm_menu_config_wizard(osv.osv_memory):
82     _name='crm.menu.config_wizard'
83     _columns = {
84         'name':fields.char('Name', size=64),
85         'meeting' : fields.boolean('Calendar of Meetings', help="Manages the calendar of meetings of the users."),
86         'lead' : fields.boolean('Leads', help="Allows you to track and manage leads which are pre-sales requests, the very first contact with a customer request."),
87         'opportunity' : fields.boolean('Business Opportunities', help="Tracks identified business opportunities for your sales pipeline."),
88         'jobs' : fields.boolean('Jobs Hiring Process', help="Help you to organise the jobs hiring process: evaluation, meetings, email integration..."),
89         'board_document':fields.boolean('Document Management', help= "The Document Management System of Open ERP allows you to store, browse, automatically index, search and preview all kind of documents (internal documents, printed reports, calendar system). It opens an FTP access for the users to easily browse association's document."),
90         'bugs' : fields.boolean('Bug Tracking', help="Used by companies to track bugs and support requests on softwares"),
91         'fund' : fields.boolean('Fund Raising Operations', help="This may help associations in their fund raising process and tracking."),
92         'helpdesk' : fields.boolean('Help Desk Operations', help="This may help your Help Desk."),
93     }
94     _defaults = {
95         'meeting': lambda *args: True,
96         'jobs': lambda *args: True,
97         'opportunity': lambda *args: True,
98     }
99     def action_create(self, cr, uid, ids, *args):
100         for res in self.read(cr,uid,ids):
101             res.__delitem__('id')
102     #        'update'
103             for section in res :
104                 if res[section]:
105                     file_name = 'crm_'+section+'_menu.xml'
106                     try:
107                         tools.convert_xml_import(cr, 'crm_configuration', tools.file_open(os.path.join('crm_configuration',file_name )),  {}, 'init', *args)
108                     except Exception, e:
109                         raise osv.except_osv('Error !', e)
110
111         return {
112                 'view_type': 'form',
113                 "view_mode": 'form',
114                 'res_model': 'ir.actions.configuration.wizard',
115                 'type': 'ir.actions.act_window',
116                 'target':'new',
117          }
118     def action_cancel(self,cr,uid,ids,conect=None):
119         return {
120                 'view_type': 'form',
121                 "view_mode": 'form',
122                 'res_model': 'ir.actions.configuration.wizard',
123                 'type': 'ir.actions.act_window',
124                 'target':'new',
125          }
126
127 crm_menu_config_wizard()
128
129 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
130