[IMP]: crm: Apply doc string + optimization
[odoo/odoo.git] / addons / crm / crm_fundraising.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
22 from osv import fields,osv,orm
23 import crm
24
25 class crm_fundraising(osv.osv):
26     """ Fund Raising Cases """
27
28     _name = "crm.fundraising"
29     _description = "Fund Raising Cases"
30     _order = "id desc"
31     _inherit ='crm.case'
32
33     _columns = {
34             'date_closed': fields.datetime('Closed', readonly=True),
35             'date': fields.datetime('Date'),
36             'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
37             'categ_id': fields.many2one('crm.case.categ','Category', \
38                                 domain="[('section_id','=',section_id),\
39                                 ('object_id.model', '=', 'crm.fundraising')]"),
40             'planned_revenue': fields.float('Planned Revenue'),
41             'planned_cost': fields.float('Planned Costs'),
42             'probability': fields.float('Probability (%)'),
43             'partner_name': fields.char("Employee's Name", size=64),
44             'partner_name2': fields.char('Employee Email', size=64),
45             'partner_phone': fields.char('Phone', size=32),
46             'partner_mobile': fields.char('Mobile', size=32),
47             'stage_id': fields.many2one ('crm.case.stage', 'Stage',\
48                              domain="[('section_id','=',section_id),\
49                             ('object_id.model', '=', 'crm.fundraising')]"),
50             'type_id': fields.many2one('crm.case.resource.type', 'Fundraising Type',\
51                              domain="[('section_id','=',section_id),\
52                              ('object_id.model', '=', 'crm.fundraising')]"),
53             'duration': fields.float('Duration'),
54             'ref': fields.reference('Reference', selection=crm._links_get, size=128),
55             'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),
56             'canal_id': fields.many2one('res.partner.canal', 'Channel',\
57                         help="The channels represent the different communication \
58                         modes available with the customer." \
59                        " With each commercial opportunity, you can indicate\
60                      the canall which is this opportunity source."),
61             'som': fields.many2one('res.partner.som', 'State of Mind',\
62                          help="The minds states allow to define a value scale which represents" \
63                               "the partner mentality in relation to our services.The scale has" \
64                             "to be created with a factor for each level from 0 \
65                              (Very dissatisfied) to 10 (Extremely satisfied)."),
66         }
67
68     _defaults = {
69                  'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
70                  'probability':lambda *a:0.0,
71                  'planned_cost':lambda *a:0.0,
72                  'planned_revenue':lambda *a:0.0,
73
74     }
75
76 crm_fundraising()