[REM]: crm: Removed crm phonecall stuff from crm (Made new module for it)
bzr revid: rpa@tinyerp.com-20100427133651-16vjlrpvpxdu9ki2
This commit is contained in:
@@ -1,121 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import crm
|
||||
import time
|
||||
|
||||
class crm_phonecall(osv.osv):
|
||||
""" Phonecall Cases """
|
||||
|
||||
_name = "crm.phonecall"
|
||||
_description = "Phonecall Cases"
|
||||
_order = "id desc"
|
||||
_inherit = 'crm.case'
|
||||
|
||||
_columns = {
|
||||
'duration': fields.float('Duration'),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category', \
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.phonecall')]"),
|
||||
'partner_phone': fields.char('Phone', size=32),
|
||||
'partner_contact': fields.related('partner_address_id', 'name',\
|
||||
type="char", string="Contact", size=128),
|
||||
'partner_mobile': fields.char('Mobile', size=32),
|
||||
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'canal_id': fields.many2one('res.partner.canal', 'Channel',\
|
||||
help="The channels represent the different communication\
|
||||
modes available with the customer." \
|
||||
" With each commercial opportunity, you can indicate\
|
||||
the canall which is this opportunity source."),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'date': fields.datetime('Date'),
|
||||
'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
|
||||
}
|
||||
|
||||
def action_make_meeting(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This opens Meeting's calendar view to schedule meeting on current Phonecall
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Meeting IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Meeting view
|
||||
"""
|
||||
value = {}
|
||||
for phonecall in self.browse(cr, uid, ids):
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
||||
# Get meeting views
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
|
||||
res = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
|
||||
if id1:
|
||||
id1 = data_obj.browse(cr, uid, id1, context=context).res_id
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
context = {
|
||||
'default_phonecall_id': phonecall.id,
|
||||
'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False,
|
||||
'default_email': phonecall.email_from ,
|
||||
'default_name': phonecall.name
|
||||
}
|
||||
|
||||
value = {
|
||||
'name': _('Meetings'),
|
||||
'domain' : "[('user_id','=',%s)]" % (uid),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'calendar,form,tree',
|
||||
'res_model': 'crm.meeting',
|
||||
'view_id': False,
|
||||
'views': [(id1, 'calendar'), (id2, 'form'), (id3, 'tree')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id'],
|
||||
'nodestroy': True
|
||||
}
|
||||
|
||||
return value
|
||||
|
||||
def onchange_partner_address_id(self, cr, uid, ids, add, email=False):
|
||||
res = super(crm_phonecall, self).onchange_partner_address_id(cr, uid, ids, add, email)
|
||||
res.setdefault('value', {})
|
||||
if add:
|
||||
address = self.pool.get('res.partner.address').browse(cr, uid, add)
|
||||
res['value']['partner_phone'] = address.mobile
|
||||
res['value']['partner_mobile'] = address.phone
|
||||
return res
|
||||
crm_phonecall()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
->
|
||||
|
||||
<!--
|
||||
Phonecall Categories
|
||||
-->
|
||||
<record model="crm.case.categ" id="categ_phone1">
|
||||
<field name="name">Inbound</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
|
||||
|
||||
</record>
|
||||
<record model="crm.case.categ" id="categ_phone2">
|
||||
<field name="name">Outbound</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Case Stage
|
||||
-->
|
||||
<record model="crm.case.stage" id="stage_phone1">
|
||||
<field name="name">Planned</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_phone2">
|
||||
<field name="name">Held</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_phone3">
|
||||
<field name="name">Not Held</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,99 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<!--
|
||||
((((((((((( Demo Cases )))))))))))
|
||||
-->
|
||||
<record id="crm_case_phone01" model="crm.phonecall">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_15"/>
|
||||
<field eval="time.strftime('%Y-%m-04 10:45:36')" name="date"/>
|
||||
<field name="partner_id" ref="base.res_partner_11"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""Left the message"" name="name"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(726) 782-0636"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_phone1"/>
|
||||
<field name="stage_id" ref="crm.stage_phone1"/>
|
||||
<field eval=""(769) 703-274"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_phone02" model="crm.phonecall">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_6"/>
|
||||
<field eval="time.strftime('%Y-%m-11 11:19:25')" name="date"/>
|
||||
<field name="partner_id" ref="base.res_partner_6"/>
|
||||
<field eval=""4"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""Get More information on the proposed deal"" name="name"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(392) 895-7917"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_phone1"/>
|
||||
<field name="stage_id" ref="crm.stage_phone2"/>
|
||||
<field eval=""(956) 293-2595"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_phone03" model="crm.phonecall">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_2"/>
|
||||
<field eval="time.strftime('%Y-%m-15 17:44:12')" name="date"/>
|
||||
<field name="partner_id" ref="base.res_partner_10"/>
|
||||
<field eval=""2"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field eval=""Bad time, will call back"" name="name"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(820) 167-3208"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_phone1"/>
|
||||
<field name="stage_id" ref="crm.stage_phone3"/>
|
||||
<field eval=""(079) 681-2139"" name="partner_phone"/>
|
||||
<field eval=""contact@tecsas.fr"" name="email_from"/>
|
||||
</record>
|
||||
<record id="crm_case_phone04" model="crm.phonecall">
|
||||
<field eval="time.strftime('%Y-%m-21 14:10:23')" name="date"/>
|
||||
<field name="partner_id" ref="base.res_partner_tinyatwork"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""Discuss Review Process"" name="name"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(077) 582-4035"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_phone2"/>
|
||||
<field name="stage_id" ref="crm.stage_phone1"/>
|
||||
<field eval=""(514) 698-4118"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_phone05" model="crm.phonecall">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_10"/>
|
||||
<field eval="time.strftime('%Y-%m-28 16:20:43')" name="date"/>
|
||||
<field name="partner_id" ref="base.res_partner_5"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""More information on the proposed deal"" name="name"/>
|
||||
<field eval=""pending"" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(333) 715-1450"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_phone2"/>
|
||||
<field name="stage_id" ref="crm.stage_phone2"/>
|
||||
<field eval=""(855) 924-4364"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_phone06" model="crm.phonecall">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_1"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="partner_id" ref="base.res_partner_9"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""Bad time"" name="name"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(468) 017-2684"" name="partner_mobile"/>
|
||||
<field eval="time.strftime('%Y-%m-28 14:15:30')" name="date"/>
|
||||
<field name="categ_id" ref="crm.categ_phone2"/>
|
||||
<field name="stage_id" ref="crm.stage_phone3"/>
|
||||
<field eval=""(373) 907-1009"" name="partner_phone"/>
|
||||
<field eval=""info@opensides.be"" name="email_from"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<act_window
|
||||
id="crm_case_categ_phone_create_partner"
|
||||
name="Schedule Phone Call"
|
||||
res_model="crm.phonecall"
|
||||
src_model="res.partner"
|
||||
view_mode="calendar,tree,form"
|
||||
context="{'default_partner_id': active_id, 'default_duration': 1.0}"
|
||||
domain="[('partner_id', '=', active_id)]"
|
||||
/>
|
||||
|
||||
<!-- PHONE CALLS (menu) -->
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_categ_phone0">
|
||||
<field name="name">Phone Calls</field>
|
||||
<field name="res_model">crm.phonecall</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,calendar</field>
|
||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone0">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone0"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_calendar_phone0">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">calendar</field>
|
||||
<field name="view_id" ref="crm_case_phone_calendar_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone0"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_form_phone0">
|
||||
<field name="sequence" eval="3"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_case_phone_form_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone0"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Phone Calls" id="menu_crm_case_phone"
|
||||
groups="base.group_extended"
|
||||
parent="base.menu_base_partner" sequence="5" />
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_categ_phone_incoming0">
|
||||
<field name="name">Inbound</field>
|
||||
<field name="res_model">crm.phonecall</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,calendar</field>
|
||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone1'))+')]'"/>
|
||||
<field name="context">{'set_editable':True,'default_state':'open'}</field>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone_incoming0">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone_incoming0"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_calendar_phone_incoming0">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">calendar</field>
|
||||
<field name="view_id" ref="crm_case_phone_calendar_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone_incoming0"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_form_phone_incoming0">
|
||||
<field name="sequence" eval="3"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_case_phone_form_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone_incoming0"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Inbound" id="menu_crm_case_phone_inbound"
|
||||
parent="crm.menu_crm_case_phone"
|
||||
action="crm_case_categ_phone_incoming0" />
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_categ_phone_outgoing0">
|
||||
<field name="name">Outbound</field>
|
||||
<field name="res_model">crm.phonecall</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,calendar</field>
|
||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone2'))+')]'"/>
|
||||
<field name="context">{'default_state':'open'}</field>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone_outgoing0">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone_outgoing0"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_calendar_phone_outgoing0">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">calendar</field>
|
||||
<field name="view_id" ref="crm_case_phone_calendar_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone_outgoing0"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_form_phone_outgoing0">
|
||||
<field name="sequence" eval="3"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_case_phone_form_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_phone_outgoing0"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Outbound" id="menu_crm_case_phone_outbound"
|
||||
parent="crm.menu_crm_case_phone"
|
||||
action="crm_case_categ_phone_outgoing0" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,208 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Phonecall Categories Form View -->
|
||||
|
||||
<record id="crm_phonecall_categ_action" model="ir.actions.act_window">
|
||||
<field name="name">Phonecall Categories</field>
|
||||
<field name="res_model">crm.case.categ</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
|
||||
<field name="domain">[('object_id.model', '=', 'crm.phonecall')]</field>
|
||||
<field name="context">{'object_id':'crm.phonecall'}</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="crm_phonecall_categ_action"
|
||||
id="menu_crm_case_phonecall-act" parent="crm.menu_crm_case_categ" />
|
||||
|
||||
<!-- ResourceType Form View -->
|
||||
|
||||
<record id="crm_phonecall_resource_act" model="ir.actions.act_window">
|
||||
<field name="name">Phonecall Resource Type</field>
|
||||
<field name="res_model">crm.case.resource.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="crm.crm_case_resource_type_tree"/>
|
||||
<field name="domain">[('object_id.model', '=', 'crm.phonecall')]</field>
|
||||
<field name="context">{'object_id':'crm.phonecall'}</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="crm_phonecall_resource_act"
|
||||
id="menu_crm_phonecall_resource_act"
|
||||
parent="crm.menu_crm_case_resource_type" />
|
||||
|
||||
|
||||
<!-- PhoneCalls Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_phone_tree_view">
|
||||
<field name="name">CRM - Phone Calls Tree</field>
|
||||
<field name="model">crm.phonecall</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<tree string="Phone Calls" colors="grey:state in ('cancel','done');blue:state in ('pending',)">
|
||||
<field name="date" string="Date"/>
|
||||
<field name="name" string="Call Summary"/>
|
||||
<field name="partner_id" string="Partner"/>
|
||||
<field name="partner_contact"/>
|
||||
<field name="partner_phone"/>
|
||||
<field name="user_id"/>
|
||||
<button string="Opportunity"
|
||||
name="%(phonecall2opportunity_act)d"
|
||||
states="draft,open,pending"
|
||||
type="action" attrs="{'invisible':[('opportunity_id','!=',False)]}" />
|
||||
<button string="Meeting"
|
||||
states="draft,open,pending"
|
||||
name="action_make_meeting" type="action" />
|
||||
<field name="state"/>
|
||||
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/>
|
||||
<button name="case_close" string="Held" states="open,draft,pending" type="object" icon="gtk-jump-to"/>
|
||||
<button name="case_pending" string="Not Held" states="open" type="object" icon="gtk-media-pause"/>
|
||||
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecalls Form View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_phone_form_view">
|
||||
<field name="name">CRM - Phone Call Form</field>
|
||||
<field name="model">crm.phonecall</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Phone Call">
|
||||
<group colspan="4" col="7">
|
||||
<field name="name" string="Call Summary"/>
|
||||
<field name="date" string="Planned Date"/>
|
||||
<field name="user_id"/>
|
||||
<button string="Schedule a Meeting"
|
||||
name="action_make_meeting"
|
||||
icon="gtk-redo"
|
||||
type="object" />
|
||||
|
||||
<field name="partner_phone"/>
|
||||
<field name="duration"/>
|
||||
<field name="section_id" colspan="1" widget="selection" />
|
||||
<button string="Convert to Opportunity"
|
||||
name="%(phonecall2opportunity_act)d"
|
||||
icon="gtk-index" type="action"
|
||||
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
|
||||
<label colspan="6" string=""/>
|
||||
<button string="Schedule Other Call"
|
||||
icon="gtk-redo"
|
||||
name="%(phonecall_to_phonecall_act)d"
|
||||
type="action" />
|
||||
|
||||
</group>
|
||||
<group col="3" colspan="2">
|
||||
<separator colspan="3" string="Contacts" />
|
||||
<field name="partner_id"
|
||||
on_change="onchange_partner_id(partner_id, email_from)" />
|
||||
<button string="Create a Partner"
|
||||
icon="terp-crm"
|
||||
name="%(action_crm_phonecall2partner)d"
|
||||
type="action"
|
||||
attrs="{'invisible':[('partner_id','!=',False)]}" />
|
||||
<newline/>
|
||||
<field name="partner_address_id" string="Contact"
|
||||
on_change="onchange_partner_address_id(partner_address_id, email_from)" />
|
||||
<newline/>
|
||||
<field name="partner_mobile" />
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Categorization" />
|
||||
<field name="priority"/>
|
||||
<field name="opportunity_id"/>
|
||||
</group>
|
||||
<separator string="Description" colspan="4" />
|
||||
<field name="description" nolabel="1" colspan="4" />
|
||||
<separator colspan="4" />
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" select="1" />
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_pending" string="Not Held"
|
||||
states="open" type="object" icon="gtk-undo" />
|
||||
<button name="case_close" string="Held"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-jump-to" />
|
||||
<button name="case_reset" string="Reset to Draft"
|
||||
states="done,cancel" type="object"
|
||||
icon="gtk-convert" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecalls Calendar View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_phone_calendar_view">
|
||||
<field name="name">CRM - Phone Calls Calendar</field>
|
||||
<field name="model">crm.phonecall</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Phone Calls" date_start="date" color="user_id" date_delay="duration">
|
||||
<field name="name"/>
|
||||
<field name="partner_id"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecalls Search View -->
|
||||
|
||||
<record id="view_crm_case_phonecalls_filter" model="ir.ui.view">
|
||||
<field name="name">CRM - Phone Calls Search</field>
|
||||
<field name="model">crm.phonecall</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Phonecalls">
|
||||
<filter icon="gtk-home" string="Today"
|
||||
domain="[('date','<', time.strftime('%%Y-%%m-%%d 23:59:59')),\
|
||||
('date','>=',datetime.strftime('%%Y-%%m-%%d 00:00:00'))]"
|
||||
help="Todays's Phonecalls"
|
||||
/>
|
||||
<filter icon="gtk-media-rewind"
|
||||
string="7 Days"
|
||||
help="Phonecalls during last 7 days"
|
||||
domain="[('date','<', time.strftime('%%Y-%%m-%%d')),\
|
||||
('date','>=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
||||
/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" string="Call Summary"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-partner"
|
||||
domain="[('user_id','=',uid)]" help="My Phonecalls"
|
||||
default="1" />
|
||||
<filter icon="terp-partner"
|
||||
domain="[('user_id','=',False)]"
|
||||
help="Unassigned Phonecalls" />
|
||||
</field>
|
||||
<field name="section_id"
|
||||
select="1" widget="selection" string="Sales Team">
|
||||
<filter icon="terp-crm"
|
||||
domain="[('section_id','=',context.get('section_id',False))]"
|
||||
help="My section" />
|
||||
</field>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="4">
|
||||
<filter string="Partner" icon="terp-crm" domain="[]"
|
||||
context="{'group_by':'partner_id'}" />
|
||||
<filter string="Responsible" icon="terp-crm"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Creation" icon="terp-project"
|
||||
domain="[]" context="{'group_by':'create_date'}" />
|
||||
<filter string="Date" icon="terp-project" domain="[]"
|
||||
context="{'group_by':'date'}" />
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,77 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
|
||||
class crm_phonecall_report(osv.osv):
|
||||
""" Phone calls by user and section """
|
||||
|
||||
_name = "crm.phonecall.report"
|
||||
_description = "Phone calls by user and section"
|
||||
_auto = False
|
||||
_inherit = "crm.case.report"
|
||||
|
||||
_columns = {
|
||||
'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category', \
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.phonecall')]"),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
|
||||
""" Phone Calls By User And Section
|
||||
@param cr: the current row, from the database cursor,
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_phonecall_report')
|
||||
cr.execute("""
|
||||
create or replace view crm_phonecall_report as (
|
||||
select
|
||||
min(c.id) as id,
|
||||
to_char(c.create_date, 'YYYY') as name,
|
||||
to_char(c.create_date, 'MM') as month,
|
||||
to_char(c.create_date, 'YYYY-MM-DD') as day,
|
||||
c.state,
|
||||
c.user_id,
|
||||
c.section_id,
|
||||
c.categ_id,
|
||||
c.partner_id,
|
||||
c.company_id,
|
||||
count(*) as nbr,
|
||||
0 as avg_answers,
|
||||
0.0 as perc_done,
|
||||
0.0 as perc_cancel,
|
||||
date_trunc('day',c.create_date) as create_date,
|
||||
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
|
||||
from
|
||||
crm_phonecall c
|
||||
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
|
||||
c.state, c.user_id,c.section_id, c.categ_id,c.partner_id,c.company_id
|
||||
,to_char(c.create_date, 'YYYY-MM-DD'),c.create_date
|
||||
)""")
|
||||
|
||||
crm_phonecall_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Phone calls by user and section Tree View -->
|
||||
|
||||
<record id="view_report_crm_phonecall_tree" model="ir.ui.view">
|
||||
<field name="name">crm.phonecall.report.tree</field>
|
||||
<field name="model">crm.phonecall.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Phone calls">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="nbr" string="#Phone calls" sum="#Phone calls"/>
|
||||
<field name="delay_close" avg="Avg Closing Delay"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phone calls by user and section Form View -->
|
||||
|
||||
<record id="view_report_crm_phonecall_form" model="ir.ui.view">
|
||||
<field name="name">crm.phonecall.report.form</field>
|
||||
<field name="model">crm.phonecall.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="nbr" position="after">
|
||||
<field name="delay_close"/>
|
||||
<field name="amount_revenue"/>
|
||||
<field name="amount_revenue_prob"/>
|
||||
<field name="probability"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phone calls by user and section Graph View -->
|
||||
|
||||
<record id="view_report_crm_phonecall_graph" model="ir.ui.view">
|
||||
<field name="name">crm.phonecall.report.graph</field>
|
||||
<field name="model">crm.phonecall.report</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph orientation="horizontal" string="Phone calls" type="bar">
|
||||
<field name="state"/>
|
||||
<field name="nbr" operator="+"/>
|
||||
<field group="True" name="user_id"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phone calls by user and section Search View -->
|
||||
|
||||
<record id="view_report_crm_phonecall_filter" model="ir.ui.view">
|
||||
<field name="name">crm.phonecall.report.select</field>
|
||||
<field name="model">crm.phonecall.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_filter"/>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr='//search[@string="Search"]/group[@string="Extended options..."]/filter[@string="Cancel"]' position='after'>
|
||||
<group>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phone calls by user and section Action -->
|
||||
|
||||
<record id="action_report_crm_phonecall" model="ir.actions.act_window">
|
||||
<field name="name">Phone Calls</field>
|
||||
<field name="res_model">crm.phonecall.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="context">{"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
<field name="view_id" ref="view_report_crm_phonecall_tree"/>
|
||||
<field name="search_view_id" ref="view_report_crm_phonecall_filter"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_phonecall_tree">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_report_crm_phonecall_tree"/>
|
||||
<field name="act_window_id" ref="action_report_crm_phonecall"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_phonecall_graph">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="view_report_crm_phonecall_graph"/>
|
||||
<field name="act_window_id" ref="action_report_crm_phonecall"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Phone Calls"
|
||||
action="action_report_crm_phonecall"
|
||||
groups="base.group_extended"
|
||||
id="menu_report_crm_phonecalls_tree" parent="base.next_id_64" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -8,7 +8,6 @@
|
||||
"access_crm_meeting","crm.meeting","model_crm_meeting","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_lead","crm.lead","model_crm_lead","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_opportunity","crm.opportunity","model_crm_opportunity","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_phonecall","crm.phonecall","model_crm_phonecall","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_case_log","crm.case.log","model_crm_case_log","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_case_history","crm.case.history","model_crm_case_history","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_case_section_manager","crm.case.section.manager","model_crm_case_section","crm.group_crm_manager",1,1,1,1
|
||||
@@ -24,15 +23,11 @@
|
||||
"access_crm_case_report_user","crm.case.report","model_crm_case_report","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_case_report_manager","crm.case.report manager","model_crm_case_report","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_lead_report_user","crm.lead.report","model_crm_lead_report","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_phonecall_report_user","crm.phonecall.report","model_crm_phonecall_report","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_opportunity_report_user","crm.opportunity.report","model_crm_opportunity_report","crm.group_crm_user",1,0,0,0
|
||||
"access_report_crm_case_service_dashboard","report.crm.case.service.dashboard","model_report_crm_case_service_dashboard","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_lead2partner","crm.lead2partner","model_crm_lead2partner","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_lead2opportunity","crm.lead2opportunity","model_crm_lead2opportunity","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_opportunity2phonecall","crm.opportunity2phonecall","model_crm_opportunity2phonecall","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_phonecall2phonecall","crm.phonecall2phonecall","model_crm_phonecall2phonecall","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_phonecall2partner","crm.phonecall2partner","model_crm_phonecall2partner","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_phonecall2opportunity","crm.phonecall2opportunity","model_crm_phonecall2opportunity","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_send_mail","crm.send.mail","model_crm_send_mail","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_partner2opportunity","crm.partner2opportunity","model_crm_partner2opportunity","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_lead2opportunity_partner","crm.lead2opportunity.partner","model_crm_lead2opportunity_partner","crm.group_crm_user",1,1,1,1
|
||||
|
||||
|
@@ -25,9 +25,6 @@ import crm_email_add_cc
|
||||
import crm_lead_to_partner
|
||||
import crm_lead_to_opportunity
|
||||
import crm_opportunity_to_phonecall
|
||||
import crm_phonecall_to_phonecall
|
||||
import crm_phonecall_to_partner
|
||||
import crm_phonecall_to_opportunity
|
||||
import crm_partner_to_opportunity
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
#===============================================================================
|
||||
# Put original wizard because of action in init
|
||||
# Remove it after solution foraction in init
|
||||
#===============================================================================
|
||||
|
||||
class phonecall2meeting(wizard.interface):
|
||||
|
||||
def _makeMeeting(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
phonecall_case_obj = pool.get('crm.phonecall')
|
||||
data_obj = pool.get('ir.model.data')
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
|
||||
id = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
|
||||
if id1:
|
||||
id1 = data_obj.browse(cr, uid, id1, context=context).res_id
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
phonecall = phonecall_case_obj.browse(cr, uid, data['id'], context=context)
|
||||
partner_id = phonecall.partner_id and phonecall.partner_id.id or False
|
||||
name = phonecall.name
|
||||
email = phonecall.email_from
|
||||
section_id = phonecall.section_id and phonecall.section_id.id or False
|
||||
return {
|
||||
'name': _('Meetings'),
|
||||
'domain' : "[('user_id','=',%s)]"%(uid),
|
||||
'context': {'default_partner_id': partner_id, 'default_section_id': section_id, 'default_email_from': email, 'default_state':'open', 'default_name':name},
|
||||
'view_type': 'form',
|
||||
'view_mode': 'calendar,form,tree',
|
||||
'res_model': 'crm.meeting',
|
||||
'view_id': False,
|
||||
'views': [(id1,'calendar'),(id2,'form'),(id3,'tree')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': id['res_id']
|
||||
}
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _makeMeeting, 'state': 'order'}
|
||||
},
|
||||
'order': {
|
||||
'actions': [],
|
||||
'result': {'type': 'state', 'state': 'end'}
|
||||
}
|
||||
}
|
||||
phonecall2meeting('crm.phonecall.meeting_set')
|
||||
|
||||
class crm_phonecall2meeting(osv.osv_memory):
|
||||
""" Phonecall to Meeting """
|
||||
|
||||
_name = 'crm.phonecall2meeting'
|
||||
_description = 'Phonecall To Meeting'
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Closes Phonecall to Meeting form
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Meeting IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
"""
|
||||
return {'type':'ir.actions.act_window_close'}
|
||||
|
||||
def action_make_meeting(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This opens Meeting's calendar view to schedule meeting on current Phonecall
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Meeting IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Meeting view
|
||||
"""
|
||||
value = {}
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
|
||||
if record_id:
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
||||
# Get meeting views
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
|
||||
res = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
|
||||
if id1:
|
||||
id1 = data_obj.browse(cr, uid, id1, context=context).res_id
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
phonecall = phonecall_obj.browse(cr, uid, record_id, context=context)
|
||||
context = {
|
||||
'default_phonecall_id': phonecall.id,
|
||||
'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False,
|
||||
'default_email': phonecall.email_from ,
|
||||
'default_name': phonecall.name
|
||||
}
|
||||
|
||||
value = {
|
||||
'name': _('Meetings'),
|
||||
'domain' : "[('user_id','=',%s)]" % (uid),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'calendar,form,tree',
|
||||
'res_model': 'crm.meeting',
|
||||
'view_id': False,
|
||||
'views': [(id1, 'calendar'), (id2, 'form'), (id3, 'tree')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
|
||||
return value
|
||||
|
||||
crm_phonecall2meeting()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Old wizard -->
|
||||
|
||||
<wizard
|
||||
id="wizard_crm_phonecall_meeting_set"
|
||||
keyword="client_action_multi"
|
||||
model="crm.phonecall"
|
||||
name="crm.phonecall.meeting_set"
|
||||
multi="True"
|
||||
string="Schedule Meeting"/>
|
||||
|
||||
<!-- Phonecall to meeting view -->
|
||||
|
||||
<record model="ir.ui.view" id="phonecall2phonecall2meeting_view">
|
||||
<field name="name">crm.phonecall2meeting.form</field>
|
||||
<field name="model">crm.phonecall2meeting</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Convert To Meeting">
|
||||
<label string="Are you sure to schedule a Meeting for this Phonecall?" colspan="4"/>
|
||||
<newline/>
|
||||
<separator colspan="4" string=""/>
|
||||
<button name="action_cancel" string="_Cancel"
|
||||
icon="gtk-cancel" special="cancel" />
|
||||
<button name="action_make_meeting" type="object"
|
||||
string="_Schedule" icon="gtk-go-forward" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecall to meeting action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="phonecall2meeting_act">
|
||||
<field name="name">Convert To Meeting</field>
|
||||
<field name="res_model">crm.phonecall2meeting</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="phonecall2phonecall2meeting_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,150 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class crm_phonecall2opportunity(osv.osv_memory):
|
||||
""" Converts Phonecall to Opportunity"""
|
||||
|
||||
_name = 'crm.phonecall2opportunity'
|
||||
_description = 'Phonecall To Opportunity'
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Closes Phonecall to Opportunity form
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Opportunity's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
return {'type':'ir.actions.act_window_close'}
|
||||
|
||||
def view_init(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function checks for precondition before wizard executes
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
"""
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
case = phonecall_obj.browse(cr, uid, record_id, context=context)
|
||||
if case.state in ['done', 'cancel']:
|
||||
raise osv.except_osv(_("Warning"), _("Closed/Cancelled Phone \
|
||||
Call Could not convert into Opportunity"))
|
||||
|
||||
|
||||
def action_apply(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This converts Phonecall to Opportunity and opens Phonecall view
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Opportunity IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Opportunity form
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
if record_id:
|
||||
opp_obj = self.pool.get('crm.opportunity')
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
case = phonecall_obj.browse(cr, uid, record_id, context=context)
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
|
||||
res = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_oppor')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_oppor')
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
new_opportunity_id = opp_obj.create(cr, uid, {
|
||||
'name': this.name,
|
||||
'planned_revenue': this.planned_revenue,
|
||||
'probability': this.probability,
|
||||
'partner_id': this.partner_id and this.partner_id.id or False,
|
||||
'section_id': case.section_id and case.section_id.id or False,
|
||||
'description': case.description or False,
|
||||
'phonecall_id': case.id,
|
||||
'priority': case.priority,
|
||||
'phone': case.partner_phone or False,
|
||||
})
|
||||
new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
|
||||
vals = {
|
||||
'partner_id': this.partner_id.id,
|
||||
'opportunity_id' : new_opportunity_id,
|
||||
}
|
||||
phonecall_obj.write(cr, uid, [case.id], vals)
|
||||
phonecall_obj.case_close(cr, uid, [case.id])
|
||||
opp_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
|
||||
value = {
|
||||
'name': _('Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.opportunity',
|
||||
'res_id': int(new_opportunity_id),
|
||||
'view_id': False,
|
||||
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Opportunity Summary', size=64, required=True, select=1),
|
||||
'probability': fields.float('Success Probability'),
|
||||
'planned_revenue': fields.float('Expected Revenue'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
res = super(crm_phonecall2opportunity, self).default_get(cr, uid, fields, context=context)
|
||||
|
||||
if record_id:
|
||||
phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
|
||||
if 'name' in fields:
|
||||
res.update({'name': phonecall.name})
|
||||
if 'partner_id' in fields:
|
||||
res.update({'partner_id': phonecall.partner_id and phonecall.partner_id.id or False})
|
||||
return res
|
||||
|
||||
crm_phonecall2opportunity()
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Phonecall to Opportunity view -->
|
||||
|
||||
<record model="ir.ui.view" id="phonecall2opportunity_view">
|
||||
<field name="name">crm.phonecall2opportunity.form</field>
|
||||
<field name="model">crm.phonecall2opportunity</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Convert To Opportunity ">
|
||||
<field name="name"/>
|
||||
<field name="partner_id" />
|
||||
<newline/>
|
||||
<field name="planned_revenue"/>
|
||||
<field name="probability"/>
|
||||
<separator string=" " colspan="4"/>
|
||||
<group colspan="4" col="3" >
|
||||
<label string=" " />
|
||||
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
|
||||
<button name="action_apply" type="object" string="_Convert" icon="gtk-convert" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecall to Opportunity action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="phonecall2opportunity_act">
|
||||
<field name="name">Convert To Opportunity</field>
|
||||
<field name="res_model">crm.phonecall2opportunity</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="phonecall2opportunity_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,204 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class crm_phonecall2partner(osv.osv_memory):
|
||||
""" Converts phonecall to partner """
|
||||
|
||||
_name = 'crm.phonecall2partner'
|
||||
_description = 'Phonecall to Partner'
|
||||
|
||||
_columns = {
|
||||
'action': fields.selection([('exist', 'Link to an existing partner'), \
|
||||
('create', 'Create a new partner')], \
|
||||
'Action', required=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner')
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function checks for precondition before wizard executes
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
"""
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
rec_ids = context and context.get('active_ids', [])
|
||||
for phonecall in phonecall_obj.browse(cr, uid, rec_ids, context=context):
|
||||
if phonecall.partner_id:
|
||||
raise osv.except_osv(_('Warning !'),
|
||||
_('A partner is already defined on this phonecall.'))
|
||||
|
||||
def _select_partner(self, cr, uid, context=None):
|
||||
"""
|
||||
This function Searches for Partner from selected phonecall.
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Partner id if any for selected phonecall.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
contact_obj = self.pool.get('res.partner.address')
|
||||
rec_ids = context and context.get('active_ids', [])
|
||||
value = {}
|
||||
|
||||
for phonecall in phonecall_obj.browse(cr, uid, rec_ids, context=context):
|
||||
partner_ids = partner_obj.search(cr, uid, [('name', '=', phonecall.name or phonecall.name)])
|
||||
if not partner_ids and phonecall.email_from:
|
||||
address_ids = contact_obj.search(cr, uid, [('email', '=', phonecall.email_from)])
|
||||
if address_ids:
|
||||
addresses = contact_obj.browse(cr, uid, address_ids)
|
||||
partner_ids = addresses and [addresses[0].partner_id.id] or False
|
||||
|
||||
partner_id = partner_ids and partner_ids[0] or False
|
||||
return partner_id
|
||||
|
||||
_defaults = {
|
||||
'action': lambda *a:'exist',
|
||||
'partner_id': _select_partner
|
||||
}
|
||||
|
||||
def open_create_partner(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Opens form of create partner.
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Partner's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for next form.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
view_obj = self.pool.get('ir.ui.view')
|
||||
view_id = view_obj.search(cr, uid, [('model', '=', 'crm.phonecall2partner'), \
|
||||
('name', '=', 'crm.phonecall2partner.view')])
|
||||
return {
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'view_id': view_id or False,
|
||||
'res_model': 'crm.phonecall2partner',
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
|
||||
def _create_partner(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Creates partner based on action.
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Partner's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary {}.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
contact_obj = self.pool.get('res.partner.address')
|
||||
partner_ids = []
|
||||
contact_id = False
|
||||
|
||||
rec_ids = context and context.get('active_ids', [])
|
||||
|
||||
for data in self.browse(cr, uid, ids):
|
||||
for phonecall in phonecall_obj.browse(cr, uid, rec_ids):
|
||||
if data.action == 'create':
|
||||
partner_id = partner_obj.create(cr, uid, {
|
||||
'name': phonecall.name or phonecall.name,
|
||||
'user_id': phonecall.user_id.id,
|
||||
'comment': phonecall.description,
|
||||
})
|
||||
contact_id = contact_obj.create(cr, uid, {
|
||||
'partner_id': partner_id,
|
||||
'name': phonecall.name,
|
||||
'phone': phonecall.partner_phone,
|
||||
})
|
||||
|
||||
else:
|
||||
if data.partner_id:
|
||||
partner_id = data.partner_id.id
|
||||
contact_id = partner_obj.address_get(cr, uid, [partner_id])['default']
|
||||
|
||||
partner_ids.append(partner_id)
|
||||
|
||||
vals = {}
|
||||
if partner_id:
|
||||
vals.update({'partner_id': partner_id})
|
||||
if contact_id:
|
||||
vals.update({'partner_address_id': contact_id})
|
||||
phonecall_obj.write(cr, uid, [phonecall.id], vals)
|
||||
return partner_ids
|
||||
|
||||
def make_partner(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Makes partner based on action.
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Partner's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Partner form.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
partner_ids = self._create_partner(cr, uid, ids, context)
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
||||
value = {
|
||||
'domain': "[]",
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'res.partner',
|
||||
'res_id': partner_ids and int(partner_ids[0]) or False,
|
||||
'view_id': False,
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
crm_phonecall2partner()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,53 +0,0 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Phonecall to partner confirmation form -->
|
||||
|
||||
<record id="view_crm_phonecall2partner_create" model="ir.ui.view">
|
||||
<field name="name">crm.phonecall2partner.view.create</field>
|
||||
<field name="model">crm.phonecall2partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create a Partner">
|
||||
<label string="Are you sure you want to create a partner based on this Phonecall ?" colspan="4"/>
|
||||
<label string="You may have to verify that this partner does not exist already." colspan="4"/>
|
||||
<separator string="" colspan="4" />
|
||||
<group col="4" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="open_create_partner" string="Create Partner" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecall to partner form view -->
|
||||
|
||||
<record id="view_crm_phonecall2partner" model="ir.ui.view">
|
||||
<field name="name">crm.phonecall2partner.view</field>
|
||||
<field name="model">crm.phonecall2partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create a Partner">
|
||||
<field name="action"/>
|
||||
<group attrs="{'invisible':[('action','!=','exist')]}">
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group col="4" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="make_partner" string="Continue" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecall to Partner wizard -->
|
||||
|
||||
<act_window id="action_crm_phonecall2partner"
|
||||
key2="client_action_multi" name="Create a Partner"
|
||||
res_model="crm.phonecall2partner" src_model="crm.phonecall"
|
||||
view_id="view_crm_phonecall2partner_create"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,137 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class crm_phonecall2phonecall(osv.osv_memory):
|
||||
""" Converts Phonecall to Phonecall"""
|
||||
|
||||
_name = 'crm.phonecall2phonecall'
|
||||
_description = 'Phonecall To Phonecall'
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Closes Phonecall to Phonecall form
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Phonecall's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
return {'type':'ir.actions.act_window_close'}
|
||||
|
||||
def action_apply(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This converts Phonecall to Phonecall and opens Phonecall view
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Phonecall IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Opportunity form
|
||||
"""
|
||||
res = {}
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
|
||||
if record_id:
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
||||
# Get Phonecall views
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
|
||||
res = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
phonecall = phonecall_obj.browse(cr, uid, record_id, context=context)
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
values = {
|
||||
'name': this.name,
|
||||
'user_id': this.user_id and this.user_id.id,
|
||||
'categ_id': phonecall.categ_id and phonecall.categ_id.id or False,
|
||||
'section_id': phonecall.section_id and phonecall.section_id.id,
|
||||
'description': phonecall.description or '',
|
||||
'partner_id': phonecall.partner_id.id,
|
||||
'partner_address_id': phonecall.partner_address_id.id,
|
||||
'partner_mobile': phonecall.partner_mobile or False,
|
||||
'priority': phonecall.priority,
|
||||
'partner_phone': phonecall.partner_phone or False,
|
||||
'date': this.date
|
||||
}
|
||||
phonecall_id = phonecall_obj.create(cr, uid, values, context=context)
|
||||
|
||||
res = {
|
||||
'name': _('Phone Call'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'crm.phonecall',
|
||||
'view_id': False,
|
||||
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': phonecall_id
|
||||
}
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Call summary', size=64, required=True, select=1),
|
||||
'user_id' : fields.many2one('res.users',"Assign To"),
|
||||
'date': fields.datetime('Date'),
|
||||
'section_id':fields.many2one('crm.case.section','Sales Team'),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
res = super(crm_phonecall2phonecall, self).default_get(cr, uid, fields, context=context)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
|
||||
if record_id:
|
||||
phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
|
||||
|
||||
if 'name' in fields:
|
||||
res.update({'name': phonecall.name})
|
||||
if 'user_id' in fields:
|
||||
res.update({'user_id': phonecall.user_id and phonecall.user_id.id or False})
|
||||
if 'date' in fields:
|
||||
res.update({'date': phonecall.date})
|
||||
if 'section_id' in fields:
|
||||
res.update({'section_id': phonecall.section_id and phonecall.section_id.id or False})
|
||||
|
||||
return res
|
||||
|
||||
crm_phonecall2phonecall()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Phonecall to Phonecall view -->
|
||||
|
||||
<record model="ir.ui.view" id="phonecall_to_phonecall_view">
|
||||
<field name="name">crm.phonecall2phonecall.form</field>
|
||||
<field name="model">crm.phonecall2phonecall</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Schedule Other Call">
|
||||
<field name="name"/>
|
||||
<field name="user_id" />
|
||||
<field name="date" string="Planned Date"/>
|
||||
<field name="section_id"/>
|
||||
<separator string=" " colspan="4"/>
|
||||
<group colspan="4" col="3" >
|
||||
<label string=" " />
|
||||
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
|
||||
<button name="action_apply" type="object" string="_Schedule" icon="gtk-go-forward" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecall to Phonecall action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="phonecall_to_phonecall_act">
|
||||
<field name="name">Schedule Other Call</field>
|
||||
<field name="res_model">crm.phonecall2phonecall</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="phonecall_to_phonecall_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user