~openerp-groupes/openobject-server/6.0-fix-setup-windows

« back to all changes in this revision

Viewing changes to bin/addons/base/res/partner/crm.py

  • Committer: pinky
  • Date: 2006-12-07 13:41:40 UTC
  • Revision ID: pinky-3f10ee12cea3c4c75cef44ab04ad33ef47432907
New trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##############################################################################
 
2
#
 
3
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
 
4
#                    Fabien Pinckaers <fp@tiny.Be>
 
5
#
 
6
# WARNING: This program as such is intended to be used by professional
 
7
# programmers who take the whole responsability of assessing all potential
 
8
# consequences resulting from its eventual inadequacies and bugs
 
9
# End users who are looking for a ready-to-use solution with commercial
 
10
# garantees and support are strongly adviced to contract a Free Software
 
11
# Service Company
 
12
#
 
13
# This program is Free Software; you can redistribute it and/or
 
14
# modify it under the terms of the GNU General Public License
 
15
# as published by the Free Software Foundation; either version 2
 
16
# of the License, or (at your option) any later version.
 
17
#
 
18
# This program is distributed in the hope that it will be useful,
 
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
# GNU General Public License for more details.
 
22
#
 
23
# You should have received a copy of the GNU General Public License
 
24
# along with this program; if not, write to the Free Software
 
25
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
26
#
 
27
##############################################################################
 
28
 
 
29
import time
 
30
from osv import fields,osv
 
31
 
 
32
 
 
33
#
 
34
# Sale/Purchase Canal, Media
 
35
#
 
36
class res_partner_canal(osv.osv):
 
37
        _name = "res.partner.canal"
 
38
        _description = "Channels"
 
39
        _columns = {
 
40
                'name': fields.char('Channel Name',size=64, required=True),
 
41
                'active': fields.boolean('Active'),
 
42
        }
 
43
        _defaults = {
 
44
                'active': lambda *a: 1,
 
45
        }
 
46
res_partner_canal()
 
47
 
 
48
#
 
49
# Partner: State of Mind
 
50
#
 
51
class res_partner_som(osv.osv):
 
52
        _name = "res.partner.som"
 
53
        _columns = {
 
54
                'name': fields.char('State of Mind',size=64, required=True),
 
55
                'factor': fields.float('Factor', required=True)
 
56
        }
 
57
res_partner_som()
 
58
 
 
59
def _links_get(self, cr, uid, context={}):
 
60
        obj = self.pool.get('res.request.link')
 
61
        ids = obj.search(cr, uid, [])
 
62
        res = obj.read(cr, uid, ids, ['object', 'name'], context)
 
63
        return [(r['object'], r['name']) for r in res]
 
64
 
 
65
class res_partner_event(osv.osv):
 
66
        _name = "res.partner.event"
 
67
        _columns = {
 
68
                'name': fields.char('Events',size=64, required=True),
 
69
                'som': fields.many2one('res.partner.som', 'State of Mind'),
 
70
                'description': fields.text('Description'),
 
71
                'planned_cost': fields.float('Planned Cost'),
 
72
                'planned_revenue': fields.float('Planned Revenue'),
 
73
                'probability': fields.float('Probability (0.50)'),
 
74
                'document': fields.reference('Document', selection=_links_get, size=128),
 
75
                'partner_id': fields.many2one('res.partner', 'Partner', select=True),
 
76
                'date': fields.datetime('Date', size=16),
 
77
                'user_id': fields.many2one('res.users', 'User'),
 
78
                'canal_id': fields.many2one('res.partner.canal', 'Channel'),
 
79
                'partner_type': fields.selection([('customer','Customer'),('retailer','Retailer'),('prospect','Commercial Prospect')], 'Partner Relation'),
 
80
                'type': fields.selection([('sale','Sale Opportunity'),('purchase','Purchase Offer'),('prospect','Prospect Contact')], 'Type of Event'),
 
81
                'event_ical_id': fields.char('iCal id', size=64),
 
82
        }
 
83
        _order = 'date desc'
 
84
        _defaults = {
 
85
                'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
 
86
        }
 
87
res_partner_event()
 
88
 
 
89
 
 
90
class res_partner_event_type(osv.osv):
 
91
        _name = "res.partner.event.type"
 
92
        _description = "Partner Events"
 
93
        _columns = {
 
94
                'name': fields.char('Event Type',size=64, required=True),
 
95
                'key': fields.char('Key', size=64, required=True),
 
96
                'active': fields.boolean('Active'),
 
97
        }
 
98
        _defaults = {
 
99
                'active': lambda *a: 1
 
100
        }
 
101
        def check(self, cr, uid, key, context={}):
 
102
                return self.search(cr, uid, [('key','=',key)])
 
103
res_partner_event_type()
 
104
 
 
105