Browse Source
Long-awaited feature : automatic pop-up on incoming calls in the OpenERP Web interface. Special thank to Jean-Sébastien Suzanne for his collaboration on this new feature.
pull/7/head
Long-awaited feature : automatic pop-up on incoming calls in the OpenERP Web interface. Special thank to Jean-Sébastien Suzanne for his collaboration on this new feature.
pull/7/head
Alexis de Lattre
11 years ago
11 changed files with 357 additions and 39 deletions
-
1asterisk_click2dial/__openerp__.py
-
14asterisk_click2dial/res_users_view.xml
-
47asterisk_click2dial/scripts/get_cid_name.py
-
12asterisk_click2dial/wizard/open_calling_partner.py
-
13asterisk_click2dial_crm/res_users_view.xml
-
22asterisk_popup/__init__.py
-
57asterisk_popup/__openerp__.py
-
37asterisk_popup/i18n/asterisk_popup.pot
-
36asterisk_popup/i18n/fr.po
-
91asterisk_popup/popup.py
-
36asterisk_popup/res_users_view.xml
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Pop-up module for OpenERP |
|||
# Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr> |
|||
# |
|||
# 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 . import popup |
@ -0,0 +1,57 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Pop-up module for OpenERP |
|||
# Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr> |
|||
# |
|||
# 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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
|
|||
{ |
|||
'name': 'Asterisk Pop-up', |
|||
'version': '0.4', |
|||
'category': 'Extra Tools', |
|||
'license': 'AGPL-3', |
|||
'summary': 'Pop-up the Partner to the User on Incoming Calls', |
|||
'description': """ |
|||
Asterisk-OpenERP Connector: Display Pop-up to User on Incoming Calls |
|||
==================================================================== |
|||
|
|||
When the user receives a phone call, OpenERP can automatically open the corresponding partner in a pop-up without any action from the user. |
|||
|
|||
The module *web_action_request* can be downloaded with Mercurial: |
|||
|
|||
hg clone http://bitbucket.org/anybox/web_action_request |
|||
|
|||
It depends on 2 other modules, *web_longpolling* and *web_socketio*, that can be downloaded with this command: |
|||
|
|||
hg clone http://bitbucket.org/anybox/web_socketio |
|||
|
|||
You will find some hints in this documentation : https://bitbucket.org/anybox/web_action_request |
|||
|
|||
Warning : proxying WebSockets is only supported since Nginx 1.3.13 ; the feature provided by this module won't work with older versions of Nginx. |
|||
|
|||
TODO : document this new feature on the Akretion Web site : http://www.akretion.com/en/products-and-services/openerp-asterisk-voip-connector """, |
|||
'author': 'Akretion', |
|||
'website': 'http://www.akretion.com/', |
|||
'depends': ['asterisk_click2dial', 'web_action_request'], |
|||
'data': [ |
|||
'res_users_view.xml', |
|||
], |
|||
'demo': [], |
|||
'images': [], |
|||
'active': False, |
|||
} |
@ -0,0 +1,37 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * asterisk_popup |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-01-31 23:34+0000\n" |
|||
"PO-Revision-Date: 2014-01-31 23:34+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_popup |
|||
#: model:ir.model,name:asterisk_popup.model_res_partner |
|||
msgid "Partner" |
|||
msgstr "" |
|||
|
|||
#. module: asterisk_popup |
|||
#: field:res.users,context_incall_popup:0 |
|||
msgid "Pop-up on Incoming Calls" |
|||
msgstr "" |
|||
|
|||
#. module: asterisk_popup |
|||
#: model:ir.model,name:asterisk_popup.model_res_users |
|||
msgid "Users" |
|||
msgstr "" |
|||
|
|||
#. module: asterisk_popup |
|||
#: view:res.users:0 |
|||
msgid "Telephony Preferences" |
|||
msgstr "" |
|||
|
@ -0,0 +1,36 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * asterisk_popup |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-01-31 23:35+0000\n" |
|||
"PO-Revision-Date: 2014-01-31 23:35+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_popup |
|||
#: model:ir.model,name:asterisk_popup.model_res_partner |
|||
msgid "Partner" |
|||
msgstr "Partenaire" |
|||
|
|||
#. module: asterisk_popup |
|||
#: field:res.users,context_incall_popup:0 |
|||
msgid "Pop-up on Incoming Calls" |
|||
msgstr "Pop-up sur Appel Entrant" |
|||
|
|||
#. module: asterisk_popup |
|||
#: model:ir.model,name:asterisk_popup.model_res_users |
|||
msgid "Users" |
|||
msgstr "Utilisateurs" |
|||
|
|||
#. module: asterisk_popup |
|||
#: view:res.users:0 |
|||
msgid "Telephony Preferences" |
|||
msgstr "Préférences téléphoniques" |
@ -0,0 +1,91 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Pop-up module for OpenERP |
|||
# Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr> |
|||
# |
|||
# 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 openerp.osv import orm, fields |
|||
import logging |
|||
|
|||
logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class res_partner(orm.Model): |
|||
_inherit = 'res.partner' |
|||
|
|||
def _prepare_incall_pop_action( |
|||
self, cr, uid, partner_res, number, context=None): |
|||
if partner_res: |
|||
action = { |
|||
'name': 'Partner', |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'res.partner', |
|||
'view_type': 'form', |
|||
'view_mode': 'form,tree,kanban', |
|||
'views': [[False, 'form']], # Beurk, but needed |
|||
'target': 'new', |
|||
'res_id': partner_res[0], |
|||
} |
|||
else: |
|||
action = { |
|||
'name': 'No Partner Found', |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'wizard.open.calling.partner', |
|||
'view_type': 'form', |
|||
'view_mode': 'form', |
|||
'views': [[False, 'form']], # Beurk, but needed |
|||
'target': 'new', |
|||
'context': {'incall_number_popup': number} |
|||
} |
|||
return action |
|||
|
|||
def incall_notify_by_login( |
|||
self, cr, uid, number, login_list, context=None): |
|||
assert isinstance(login_list, list), 'login_list must be a list' |
|||
res = self.get_partner_from_phone_number( |
|||
cr, uid, number, context=context) |
|||
user_ids = self.pool['res.users'].search( |
|||
cr, uid, [('login', 'in', login_list)], context=context) |
|||
logger.debug( |
|||
'Notify incoming call from number %s to users %s' |
|||
% (number, user_ids)) |
|||
action = self._prepare_incall_pop_action( |
|||
cr, uid, res, number, context=context) |
|||
if action: |
|||
users = self.pool['res.users'].read( |
|||
cr, uid, user_ids, ['context_incall_popup'], context=context) |
|||
for user in users: |
|||
if user['context_incall_popup']: |
|||
self.pool['action.request'].notify( |
|||
cr, uid, to_id=user['id'], **action) |
|||
logger.debug( |
|||
'This action has been sent to user ID %d: %s' |
|||
% (user['id'], action)) |
|||
return res |
|||
|
|||
|
|||
class res_users(orm.Model): |
|||
_inherit = 'res.users' |
|||
|
|||
_columns = { |
|||
'context_incall_popup': fields.boolean('Pop-up on Incoming Calls'), |
|||
} |
|||
|
|||
_defaults = { |
|||
'context_incall_popup': True, |
|||
} |
@ -0,0 +1,36 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr> |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="asterisk_res_users" model="ir.ui.view"> |
|||
<field name="name">asterisk.popup.res.users.form</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="asterisk_server_id" position="after"> |
|||
<field name="context_incall_popup"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_users_form_simple_modif" model="ir.ui.view"> |
|||
<field name="name">asterisk.popup.preferences.view</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="asterisk_click2dial.view_users_form_simple_modif" /> |
|||
<field name="arch" type="xml"> |
|||
<group name="telephony" position="inside"> |
|||
<field name="context_incall_popup" readonly="0"/> |
|||
</group> |
|||
<group name="telephony" position="attributes"> |
|||
<attribute name="string">Telephony Preferences</attribute> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue