Launchpad automatic translations update.
[odoo/odoo.git] / addons / crm_fundraising / 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
23 from crm import crm
24
25 class crm_fundraising(crm.crm_case, osv.osv):
26     """ Fund Raising Cases """
27
28     _name = "crm.fundraising"
29     _description = "Fund Raising"
30     _order = "id desc"
31     _inherit = ['mailgate.thread']
32     _columns = {
33             'id': fields.integer('ID'), 
34             'name': fields.char('Name', size=128, required=True),
35             'active': fields.boolean('Active', required=False), 
36             'date_action_last': fields.datetime('Last Action', readonly=1),
37             'date_action_next': fields.datetime('Next Action', readonly=1), 
38             'description': fields.text('Description'), 
39             'create_date': fields.datetime('Creation Date' , readonly=True), 
40             'write_date': fields.datetime('Update Date' , readonly=True), 
41             'date_deadline': fields.date('Deadline'), 
42             'user_id': fields.many2one('res.users', 'Responsible'), 
43             'section_id': fields.many2one('crm.case.section', 'Sales Team', \
44                             select=True, help='Sales team to which Case belongs to. Define Responsible user and Email account for mail gateway.'), 
45             'company_id': fields.many2one('res.company', 'Company'), 
46             'partner_id': fields.many2one('res.partner', 'Partner'), 
47             'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \
48                                  domain="[('partner_id','=',partner_id)]"), 
49             'email_cc': fields.text('Watchers Emails', size=252 , help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"), 
50             'email_from': fields.char('Email', size=128, help="These people will receive email."), 
51             'date_closed': fields.datetime('Closed', readonly=True), 
52             'date': fields.datetime('Date'), 
53             'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 
54             'categ_id': fields.many2one('crm.case.categ', 'Category', \
55                                 domain="[('section_id','=',section_id),\
56                                 ('object_id.model', '=', 'crm.fundraising')]"), 
57             'planned_revenue': fields.float('Planned Revenue'), 
58             'planned_cost': fields.float('Planned Costs'), 
59             'probability': fields.float('Probability (%)'), 
60             'partner_name': fields.char("Employee's Name", size=64), 
61             'partner_name2': fields.char('Employee Email', size=64), 
62             'partner_phone': fields.char('Phone', size=32), 
63             'partner_mobile': fields.char('Mobile', size=32), 
64             'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('type', '=', 'fundraising')]"), 
65             'type_id': fields.many2one('crm.case.resource.type', 'Campaign', \
66                              domain="[('section_id','=',section_id)]"), 
67             'duration': fields.float('Duration'), 
68             'ref': fields.reference('Reference', selection=crm._links_get, size=128), 
69             'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128), 
70             'canal_id': fields.many2one('res.partner.canal', 'Channel', \
71                         help="The channels represent the different communication \
72  modes available with the customer."), 
73             'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True, 
74                                   help='The state is set to \'Draft\', when a case is created.\
75                                   \nIf the case is in progress the state is set to \'Open\'.\
76                                   \nWhen the case is over, the state is set to \'Done\'.\
77                                   \nIf the case needs to be reviewed then the state is set to \'Pending\'.'), 
78             'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
79         }
80
81     _defaults = {
82             'active': lambda *a: 1, 
83             'user_id': crm.crm_case._get_default_user, 
84             'partner_id': crm.crm_case._get_default_partner, 
85             'partner_address_id': crm.crm_case._get_default_partner_address, 
86             'email_from': crm.crm_case. _get_default_email, 
87             'state': lambda *a: 'draft', 
88             'section_id': crm.crm_case. _get_section, 
89             'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.case', context=c), 
90             'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], 
91             'probability': lambda *a:0.0, 
92             'planned_cost': lambda *a:0.0, 
93             'planned_revenue': lambda *a:0.0, 
94             }
95
96 crm_fundraising()
97
98
99 class crm_stage_fundraising(osv.osv):
100     
101     def _get_type_value(self, cr, user, context):
102         list = super(crm_stage_fundraising, self)._get_type_value(cr, user, context)
103         list.append(('fundraising','Fundraising'))
104         return list
105     
106     _inherit = "crm.case.stage"
107     _columns = {
108             'type': fields.selection(_get_type_value, 'Type'),
109     }
110    
111     
112 crm_stage_fundraising()