Browse Source

asterisk_click2dial_crm :

- when you do a click2dial, it now triggers a wizard that proposes to create a CRM phone call (instead of directly creating the CRM phone call)
- Add option on res_users for users who don't want to trigger the wizard when they do a click2dial
- Add FR translation
- update module description and module category

asterisk_click2dial :
- update module category
pull/26/head
Alexis de Lattre 13 years ago
parent
commit
2545c13286
  1. 2
      asterisk_click2dial/__openerp__.py
  2. 4
      asterisk_click2dial/asterisk_click2dial.py
  3. 11
      asterisk_click2dial_crm/__init__.py
  4. 39
      asterisk_click2dial_crm/__openerp__.py
  5. 73
      asterisk_click2dial_crm/asterisk_click2dial_crm.py
  6. 78
      asterisk_click2dial_crm/i18n/asterisk_click2dial_crm.pot
  7. 78
      asterisk_click2dial_crm/i18n/fr.po
  8. 24
      asterisk_click2dial_crm/res_users_view.xml
  9. 23
      asterisk_click2dial_crm/wizard/__init__.py
  10. 76
      asterisk_click2dial_crm/wizard/create_crm_phonecall.py
  11. 37
      asterisk_click2dial_crm/wizard/create_crm_phonecall_view.xml
  12. 6
      asterisk_click2dial_crm/wizard/open_calling_partner_view.xml

2
asterisk_click2dial/__openerp__.py

@ -23,7 +23,7 @@
{
'name': 'Asterisk Click2dial',
'version': '0.3',
'category': 'Generic Modules/Others',
'category': 'Extra Tools',
'license': 'AGPL-3',
'description': """This module adds 3 functionnalities :

4
asterisk_click2dial/asterisk_click2dial.py

@ -489,9 +489,9 @@ class wizard_open_calling_partner(osv.osv_memory):
'''Thanks to the default_get method, we are able to query Asterisk and
get the corresponding partner when we launch the wizard'''
res = {}
#calling_number = self.pool.get('asterisk.server')._connect_to_asterisk(cr, uid, method='get_calling_number', context=context)
calling_number = self.pool.get('asterisk.server')._connect_to_asterisk(cr, uid, method='get_calling_number', context=context)
#To test the code without Asterisk server
calling_number = "0141981242"
#calling_number = "0141981242"
if calling_number:
res['calling_number'] = calling_number
# We match only on the end of the phone number

11
asterisk_click2dial_crm/__init__.py

@ -1,10 +1,11 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Jesús Martín <jmartin@zikzakmedia.com>
# $Id$
# Copyright (c) 2012 Akretion (http://www.akretion.com)
# @author: Jesús Martín <jmartin@zikzakmedia.com>
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# 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
@ -21,5 +22,5 @@
#
##############################################################################
import res_partner_address
import asterisk_click2dial_crm
import wizard

39
asterisk_click2dial_crm/__openerp__.py

@ -1,10 +1,11 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Jesús Martín <jmartin@zikzakmedia.com>
# $Id$
# Copyright (c) 2012 Akretion (http://www.akretion.com)
# @author: Jesús Martín <jmartin@zikzakmedia.com>
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# 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
@ -22,19 +23,31 @@
##############################################################################
{
'name': 'Asterisk Click2dial CRM',
"name": "Asterisk Click2dial CRM",
"version": "0.1",
"author": "Zikzakmedia SL",
"author": "Zikzakmedia SL, Akretion",
"website": "http://www.zikzakmedia.com",
"license" : "AGPL-3",
'category': 'Generic Modules/Others',
"category": "Customer Relationship Management",
"description": """
Create a outbound phone call in the CRM when the user makes a call phone
by clicking the click2dial button of the partner address view,
and opens it in a new tab.
This module adds CRM-specific features to the asterisk_click2dial module.
Also proposes to create an inbound phone call in the CRM when the user receives
a phone calls and clicks on "Open calling partner".
It adds 2 features :
First, when you do a click2dial, OpenERP will propose you to create an
outbound phone call in the CRM ; if you answer 'Yes', it will create the phone
call in the CRM and open it in a new tab. If some users don't want to be asked
to create a phone call in the CRM each time they do a click2dial, you
should disable the corresponding option in the 'Telephony' tab of the 'User'
form.
Second, when you receive a phone call and run the wizard "Open calling partner",
if the partner is found in OpenERP, you will see a button that proposes to create
an inbound phone call in the CRM.
This module has been initially developped by Zikzakmedia and has been enhanced by Akretion.
A detailed documentation for the OpenERP-Asterisk connector is available on the Akretion Web site : http://www.akretion.com/en/products-and-services/openerp-asterisk-voip-connector
""",
"depends": [
'asterisk_click2dial',
@ -43,7 +56,9 @@
"init_xml": [],
"demo_xml": [],
"update_xml": [
'open_calling_partner_view.xml',
'wizard/open_calling_partner_view.xml',
'wizard/create_crm_phonecall_view.xml',
'res_users_view.xml',
],
"installable": True,
}

73
asterisk_click2dial_crm/asterisk_click2dial_crm.py

@ -0,0 +1,73 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Copyright (c) 2012 Akretion (http://www.akretion.com)
# @author: Jesús Martín <jmartin@zikzakmedia.com>
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# 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
# Lib to translate error messages
from tools.translate import _
class res_partner_address(osv.osv):
_inherit = "res.partner.address"
def dial(self, cr, uid, ids, phone_field='phone', context=None):
'''
This method open the phone call history when the phone click2dial
button of asterisk_click2dial module is pressed
:return the phone call history view of the partner
'''
if context is None:
context = {}
super(res_partner_address, self).dial(cr, uid, ids, phone_field=phone_field, context=context)
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
context['partner_address_id'] = ids[0]
action_start_wizard = {
'name': 'Create phone call in CRM',
'type': 'ir.actions.act_window',
'res_model': 'wizard.create.crm.phonecall',
'view_type': 'form',
'view_mode': 'form',
'nodestroy': True,
'target': 'new',
'context': context,
}
if user.propose_creation_crm_phonecall:
return action_start_wizard
else:
return True
res_partner_address()
class res_users(osv.osv):
_inherit = "res.users"
_columns = {
'propose_creation_crm_phonecall': fields.boolean('Propose to create a call in CRM after a click2dial'),
}
_defaults = {
'propose_creation_crm_phonecall': True,
}
res_users()

78
asterisk_click2dial_crm/i18n/asterisk_click2dial_crm.pot

@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.2\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2011-11-09 15:28+0000\n"
"PO-Revision-Date: 2011-11-09 15:28+0000\n"
"Project-Id-Version: OpenERP Server 6.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-02 23:46+0000\n"
"PO-Revision-Date: 2012-06-02 23:46+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -16,23 +16,63 @@ msgstr ""
"Plural-Forms: \n"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_partner_address
msgid "Partner Addresses"
msgstr "Partner Addresses"
#: model:ir.actions.act_window,name:asterisk_click2dial_crm.action_create_crm_phonecall
msgid "Create CRM phonecall"
msgstr ""
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/wizard/create_crm_phonecall.py:45
#, python-format
msgid "Call with"
msgstr ""
#. module: asterisk_click2dial_crm
#: view:wizard.open.calling.partner:0
msgid "Create call in CRM"
msgstr ""
#. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "CRM phone call"
msgstr ""
#. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "No"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_open_calling_partner
msgid "wizard.open.calling.partner"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.module.module,description:asterisk_click2dial_crm.module_meta_information
msgid "\n"
" Create a outbound phone call when the user makes a call phone by clicking\n"
" the click2dial button of the partner address view, and opens it in a new tab.\n"
" "
msgstr "\n"
" Create a outbound phone call when the user makes a call phone by clicking\n"
" the click2dial button of the partner address view, and opens it in a new tab.\n"
" "
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_create_crm_phonecall
msgid "wizard.create.crm.phonecall"
msgstr ""
#. module: asterisk_click2dial_crm
#: field:res.users,propose_creation_crm_phonecall:0
msgid "Propose to create a call in CRM after a click2dial"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.module.module,shortdesc:asterisk_click2dial_crm.module_meta_information
msgid "Asterisk Click2dial CRM"
msgstr "Asterisk Click2dial CRM"
#: view:wizard.create.crm.phonecall:0
msgid "Create a phone call in the CRM ?"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_users
msgid "res.users"
msgstr ""
#. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "Yes"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_partner_address
msgid "Partner Addresses"
msgstr ""

78
asterisk_click2dial_crm/i18n/fr.po

@ -0,0 +1,78 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * asterisk_click2dial_crm
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-02 23:47+0000\n"
"PO-Revision-Date: 2012-06-02 23:47+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: asterisk_click2dial_crm
#: model:ir.actions.act_window,name:asterisk_click2dial_crm.action_create_crm_phonecall
msgid "Create CRM phonecall"
msgstr "Créer un appel dans la CRM"
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/wizard/create_crm_phonecall.py:45
#, python-format
msgid "Call with"
msgstr "Conversation avec"
#. module: asterisk_click2dial_crm
#: view:wizard.open.calling.partner:0
msgid "Create call in CRM"
msgstr "Créer un appel dans la CRM"
#. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "CRM phone call"
msgstr "Appel dans la CRM"
#. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "No"
msgstr "Non"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_open_calling_partner
msgid "wizard.open.calling.partner"
msgstr "wizard.open.calling.partner"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_create_crm_phonecall
msgid "wizard.create.crm.phonecall"
msgstr "wizard.create.crm.phonecall"
#. module: asterisk_click2dial_crm
#: field:res.users,propose_creation_crm_phonecall:0
msgid "Propose to create a call in CRM after a click2dial"
msgstr "Propose de créer un appel dans la CRM après un click2dial"
#. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "Create a phone call in the CRM ?"
msgstr "Créer un appel téléphonique dans la CRM ?"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_users
msgid "res.users"
msgstr "res.users"
#. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "Yes"
msgstr "Oui"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_partner_address
msgid "Partner Addresses"
msgstr "Carnet d'adresses"

24
asterisk_click2dial_crm/res_users_view.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<!-- Add option on user form view -->
<record id="asterisk_crm_option_view" model="ir.ui.view">
<field name="name">asterisk.crm.option.view</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="asterisk_click2dial.asterisk_res_users_internal_number"/>
<field name="arch" type="xml">
<field name="variable" position="after">
<field name="propose_creation_crm_phonecall"/>
</field>
</field>
</record>
</data>
</openerp>

23
asterisk_click2dial_crm/wizard/__init__.py

@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2012 Akretion (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# 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/>.
#
##############################################################################
import create_crm_phonecall

76
asterisk_click2dial_crm/res_partner_address.py → asterisk_click2dial_crm/wizard/create_crm_phonecall.py

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Copyright (c) 2012 Akretion (http://www.akretion.com)
# @author: Jesús Martín <jmartin@zikzakmedia.com>
@ -26,56 +26,23 @@ from osv import osv, fields
# Lib to translate error messages
from tools.translate import _
class res_partner_address(osv.osv):
_inherit = "res.partner.address"
def dial(self, cr, uid, ids, phone_field='phone', context=None):
'''
This method open the phone call history when the phone click2dial
button of asterisk_click2dial module is pressed
:return the phone call history view of the partner
'''
if context is None:
context = {}
super(res_partner_address, self).dial(cr, uid, ids, phone_field=phone_field, context=context)
return self.create_open_phonecall(cr, uid, ids, crm_categ='Outbound', context=context)
class wizard_create_crm_phonecall(osv.osv_memory):
_name = "wizard.create.crm.phonecall"
def button_create_outgoing_phonecall(self, cr, uid, ids, context=None):
partner_address = self.pool.get('res.partner.address').browse(cr, uid, context.get('partner_address_id'), context=context)
return self._create_open_crm_phonecall(cr, uid, partner_address, crm_categ='Outbound', context=context)
def create_open_phonecall(self, cr, uid, ids, crm_categ, context=None):
def _create_open_crm_phonecall(self, cr, uid, partner_address, crm_categ, context=None):
if context is None:
context = {}
crm_phonecall_id = self.create_phonecall(cr, uid, ids, crm_categ=crm_categ, context=context)
partner = self.browse(cr, uid, ids[0], context=context).partner_id
return {
'name': partner.name,
'domain': "[('partner_address_id.partner_id.id', '=', %s)]" % partner.id,
'res_model': 'crm.phonecall',
'res_id': [crm_phonecall_id],
'view_type': 'form',
'view_mode': 'form,tree',
'type': 'ir.actions.act_window',
'nodestroy': True,
'target': 'current',
'context': context,
}
def create_phonecall(self, cr, uid, ids, crm_categ='Outbound', context=None):
'''
This method creates a phone call history when the phone click2dial
button of asterisk_click2dial module is pressed and opens it.
:return True
'''
if context is None:
context = {}
crm_phonecall_obj = self.pool.get('crm.phonecall')
partner_address = self.browse(cr, uid, ids[0], context=context)
categ_ids = self.pool.get('crm.case.categ').search(cr, uid, [('name','=',crm_categ)], context={'lang': 'en_US'})
case_section_ids = self.pool.get('crm.case.section').search(cr, uid, [('member_ids', 'in', uid)], context=context)
values = {
'name': "CRM Call", # TODO check name
'name': _('Call with') + ' ' + partner_address.name,
'partner_id': partner_address.partner_id and partner_address.partner_id.id or False,
'partner_address_id': partner_address.id,
'partner_phone': partner_address.phone,
@ -84,20 +51,37 @@ class res_partner_address(osv.osv):
'user_id': uid,
'categ_id': categ_ids and categ_ids[0] or False,
'section_id': case_section_ids and case_section_ids[0] or False,
# As we now ask the user if he wants to create a phone call in CRM,
# we suppose that he will decide to create one only if the call
# has succeeded, so we create it directly in 'Held' (done) state.
# Otherwise, it would have been created in 'Todo' (open) state.
'state': 'done',
}
crm_phonecall_id = crm_phonecall_obj.create(cr, uid, values, context=context)
return crm_phonecall_id
res_partner_address()
return {
'name': partner_address.name,
'domain': [('partner_id', '=', partner_address.partner_id.id)],
'res_model': 'crm.phonecall',
'res_id': [crm_phonecall_id],
'view_type': 'form',
'view_mode': 'form,tree',
'type': 'ir.actions.act_window',
'nodestroy': False, # close the pop-up wizard after action
'target': 'current',
'context': context,
}
wizard_create_crm_phonecall()
class wizard_open_calling_partner(osv.osv_memory):
_inherit = "wizard.open.calling.partner"
def create_incoming_phonecall(self, cr, uid, ids, crm_categ, context=None):
'''Started by button on 'open calling partner wizard'''
partner_address_id = self.browse(cr, uid, ids[0], context=context).partner_address_id.id
action = self.pool.get('res.partner.address').create_open_phonecall(cr, uid, [partner_address_id], crm_categ='Inbound', context=context)
action['nodestroy'] = False
partner_address = self.browse(cr, uid, ids[0], context=context).partner_address_id
action = self.pool.get('wizard.create.crm.phonecall')._create_open_crm_phonecall(cr, uid, partner_address, crm_categ='Inbound', context=context)
return action
wizard_open_calling_partner()

37
asterisk_click2dial_crm/wizard/create_crm_phonecall_view.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 Akretion (http://www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<!-- Add button on the "Get partner from incoming phone call view" -->
<record id="create_crm_phonecall_view" model="ir.ui.view">
<field name="name">create_crm_phonecall.view</field>
<field name="model">wizard.create.crm.phonecall</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="CRM phone call">
<label string="Create a phone call in the CRM ?" colspan="2"/>
<newline />
<button name="button_create_outgoing_phonecall" icon="gtk-new" string="Yes" type="object"/>
<button special="cancel" icon="gtk-cancel" string="No" />
</form>
</field>
</record>
<record id="action_create_crm_phonecall" model="ir.actions.act_window">
<field name="name">Create CRM phonecall</field>
<field name="res_model">wizard.create.crm.phonecall</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

6
asterisk_click2dial_crm/open_calling_partner_view.xml → asterisk_click2dial_crm/wizard/open_calling_partner_view.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial CRM module for OpenERP
Copyright (C) 2012 Akretion (http://www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
@ -10,7 +9,6 @@
<data>
<!-- Add button on the "Get partner from incoming phone call view" -->
<record id="asterisk_click2dial_crm_open_calling_partner_view" model="ir.ui.view">
<field name="name">asterisk_click2dial_crm.open_calling_partner.view</field>
<field name="model">wizard.open.calling.partner</field>
@ -20,6 +18,10 @@
<button name="open_invoices" position="after">
<button name="create_incoming_phonecall" icon="gtk-new" string="Create call in CRM" type="object" />
</button>
<!-- We enlarge the small original 'Cancel' button -->
<xpath expr="/form/group/button[@name='open_partner']/../button[@special='cancel']" position="attributes">
<attribute name="colspan">4</attribute>
</xpath>
</field>
</record>
Loading…
Cancel
Save