1
##############################################################################
3
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
4
# Fabien Pinckaers <fp@tiny.Be>
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
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.
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.
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.
27
##############################################################################
30
from osv import fields,osv
34
# Sale/Purchase Canal, Media
36
class res_partner_canal(osv.osv):
37
_name = "res.partner.canal"
38
_description = "Channels"
40
'name': fields.char('Channel Name',size=64, required=True),
41
'active': fields.boolean('Active'),
44
'active': lambda *a: 1,
49
# Partner: State of Mind
51
class res_partner_som(osv.osv):
52
_name = "res.partner.som"
54
'name': fields.char('State of Mind',size=64, required=True),
55
'factor': fields.float('Factor', required=True)
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]
65
class res_partner_event(osv.osv):
66
_name = "res.partner.event"
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),
85
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
90
class res_partner_event_type(osv.osv):
91
_name = "res.partner.event.type"
92
_description = "Partner Events"
94
'name': fields.char('Event Type',size=64, required=True),
95
'key': fields.char('Key', size=64, required=True),
96
'active': fields.boolean('Active'),
99
'active': lambda *a: 1
101
def check(self, cr, uid, key, context={}):
102
return self.search(cr, uid, [('key','=',key)])
103
res_partner_event_type()