parent
11bdcff4c2
commit
62e890eded
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<!--
|
||||
Case Sections
|
||||
-->
|
||||
<record model="crm.case.section" id="section_support_help">
|
||||
<field name="name">HelpDesk</field>
|
||||
<field name="code">HD</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,114 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id: makesale.py 1183 2005-08-23 07:43:32Z pinky $
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx.DateTime import now
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
case_form = """<?xml version="1.0"?>
|
||||
<form string="Convert To Opportunity">
|
||||
<field name="name"/>
|
||||
<newline/>
|
||||
<field name="planned_revenue"/>
|
||||
<field name="probability"/>
|
||||
</form>"""
|
||||
|
||||
case_fields = {
|
||||
'name': {'type':'char', 'size':64, 'string':'Opportunity Summary'},
|
||||
'planned_revenue': {'type':'float', 'digits':(16,2), 'string': 'Expected Revenue'},
|
||||
'probability': {'type':'float', 'digits':(16,2), 'string': 'Success Probability'},
|
||||
}
|
||||
|
||||
|
||||
class make_opportunity(wizard.interface):
|
||||
|
||||
def _selectopportunity(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
case_obj = pool.get('crm.case')
|
||||
for case in case_obj.browse(cr, uid, data['ids']):
|
||||
if not case.partner_id:
|
||||
raise wizard.except_wizard("Warning !",
|
||||
_('You must assign a partner to this lead before converting to opportunity.\n' \
|
||||
'You can use the convert to partner button.'))
|
||||
return {'name': case.name, 'probability': case.probability or 20.0, 'planned_revenue':case.planned_revenue}
|
||||
|
||||
def _makeOrder(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
section_obj = pool.get('crm.case.section')
|
||||
data_obj = pool.get('ir.model.data')
|
||||
id = section_obj.search(cr, uid, [('code','=','oppor')], context=context)
|
||||
if not id:
|
||||
raise wizard.except_wizard(_("Error !"),
|
||||
_('You did not installed the opportunities tracking when you configured the crm_configuration module.' \
|
||||
'\nI can not convert the lead to an opportunity, you must create a section with the code \'oppor\'.'
|
||||
))
|
||||
id = id[0]
|
||||
|
||||
id2 = data_obj._get_id(cr, uid, 'crm_configuration', 'crm_case_form_view_oppor')
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
|
||||
|
||||
case_obj = pool.get('crm.case')
|
||||
case_obj.write(cr, uid, data['ids'], {
|
||||
'section_id': id,
|
||||
'name': data['form']['name'],
|
||||
'planned_revenue': data['form']['planned_revenue'],
|
||||
'probability': data['form']['probability'],
|
||||
})
|
||||
value = {
|
||||
'domain': "[]",
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.case',
|
||||
'res_id': int(data['ids'][0]),
|
||||
'view_id': False,
|
||||
'views': [(id2,'form'),(False,'tree'),(False,'calendar'),(False,'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
return value
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_selectopportunity],
|
||||
'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
|
||||
'state' : [('end', 'Cancel', 'gtk-cancel'),('confirm', 'Create Opportunity', 'gtk-go-forward')]}
|
||||
},
|
||||
'confirm': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _makeOrder, 'state': 'end'}
|
||||
}
|
||||
}
|
||||
|
||||
make_opportunity('crm.case.opportunity_set')
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id: makesale.py 1183 2005-08-23 07:43:32Z pinky $
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx.DateTime import now
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
case_form = """<?xml version="1.0"?>
|
||||
<form string="Convert To Partner">
|
||||
<label string="Are you sure you want to create a partner based on this lead ?" colspan="4"/>
|
||||
<label string="You may have to verify that this partner does not exist already." colspan="4"/>
|
||||
<field name="close"/>
|
||||
</form>"""
|
||||
|
||||
case_fields = {
|
||||
'close': {'type':'boolean', 'string':'Close Lead'}
|
||||
}
|
||||
|
||||
|
||||
class make_partner(wizard.interface):
|
||||
|
||||
def _selectPartner(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
case_obj = pool.get('crm.case')
|
||||
for case in case_obj.browse(cr, uid, data['ids']):
|
||||
if case.partner_id:
|
||||
raise wizard.except_wizard("Warning !",
|
||||
_('A partner is already defined on this lead.'))
|
||||
return {}
|
||||
|
||||
def _makeOrder(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
case_obj = pool.get('crm.case')
|
||||
partner_obj = pool.get('res.partner')
|
||||
contact_obj = pool.get('res.partner.address')
|
||||
for case in case_obj.browse(cr, uid, data['ids']):
|
||||
partner_id = partner_obj.create(cr, uid, {
|
||||
'name': case.partner_name or case.name,
|
||||
'user_id': case.user_id.id,
|
||||
'comment': case.note,
|
||||
})
|
||||
contact_id = contact_obj.create(cr, uid, {
|
||||
'partner_id': partner_id,
|
||||
'name': case.partner_name2,
|
||||
'phone': case.partner_phone,
|
||||
'mobile': case.partner_mobile,
|
||||
'email': case.email_from
|
||||
})
|
||||
|
||||
|
||||
case_obj.write(cr, uid, data['ids'], {
|
||||
'partner_id': partner_id,
|
||||
'partner_address_id': contact_id
|
||||
})
|
||||
if data['form']['close']:
|
||||
case_obj.case_close(cr, uid, data['ids'])
|
||||
|
||||
value = {
|
||||
'domain': "[]",
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'res.partner',
|
||||
'res_id': int(partner_id),
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
return value
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_selectPartner],
|
||||
'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
|
||||
'state' : [('end', 'Cancel', 'gtk-cancel'),('confirm', 'Create Partner', 'gtk-go-forward')]}
|
||||
},
|
||||
'confirm': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _makeOrder, 'state': 'end'}
|
||||
}
|
||||
}
|
||||
|
||||
make_partner('crm.case.partner_create')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record model="document.directory" id="dir_calendars">
|
||||
<field name="name">Calendars</field>
|
||||
</record>
|
||||
|
||||
<record model="document.directory.content" id="dir_content_calendar">
|
||||
<field name="name">Calendars</field>
|
||||
<field name="suffix">meetings</field>
|
||||
<field name="directory_id" ref="dir_calendars"/>
|
||||
<field name="extension">.ics</field>
|
||||
<field name="include_name" eval="False"/>
|
||||
<field name="ics_object_id" ref="crm.model_crm_case"/>
|
||||
<field name="ics_domain">[('section_id','=','Calendar')]</field>
|
||||
</record>
|
||||
|
||||
<record model="document.directory.ics.fields" id="dir_field1">
|
||||
<field name="name">dtstart</field>
|
||||
<field name="field_id" ref="crm.field_crm_case_date"/>
|
||||
<field name="content_id" ref="dir_content_calendar"/>
|
||||
</record>
|
||||
<record model="document.directory.ics.fields" id="dir_field2">
|
||||
<field name="name">summary</field>
|
||||
<field name="field_id" ref="crm.field_crm_case_name"/>
|
||||
<field name="content_id" ref="dir_content_calendar"/>
|
||||
</record>
|
||||
<record model="document.directory.ics.fields" id="dir_field3">
|
||||
<field name="name">uid</field>
|
||||
<field name="field_id" ref="field_crm_case_code"/>
|
||||
<field name="content_id" ref="dir_content_calendar"/>
|
||||
</record>
|
||||
<record model="document.directory.ics.fields" id="dir_field4">
|
||||
<field name="name">description</field>
|
||||
<field name="field_id" ref="crm_configuration.field_crm_case_note"/>
|
||||
<field name="content_id" ref="dir_content_calendar"/>
|
||||
</record>
|
||||
<record model="document.directory.ics.fields" id="dir_field5">
|
||||
<field name="name">url</field>
|
||||
<field name="field_id" ref="crm.field_crm_case_email_from"/>
|
||||
<field name="content_id" ref="dir_content_calendar"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_form_view_oppor">
|
||||
<field name="name">CRM - Opportunities - Quote Inherit</field>
|
||||
<field name="model">crm.case</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="crm_configuration.crm_case_form_view_oppor"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="user_id" position="after">
|
||||
<button string="Convert to Quote" icon="terp-sale" name="%(sale_crm_wizard)d" type="action"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
Loading…
Reference in New Issue