Browse Source

Merge pull request #171 from akretion/10-mig-base_phone_popup

[MIG] base_phone_popup to v10
10.0
Alexis de Lattre 5 years ago
committed by GitHub
parent
commit
2035333315
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      base_phone_popup/__init__.py
  2. 38
      base_phone_popup/__manifest__.py
  3. 3
      base_phone_popup/models/__init__.py
  4. 37
      base_phone_popup/models/phone_common.py
  5. 1
      base_phone_popup/readme/CONTRIBUTORS.rst
  6. 3
      base_phone_popup/readme/DESCRIPTION.rst
  7. 1
      base_phone_popup/readme/USAGE.rst
  8. 39
      base_phone_popup/res_users_view.xml
  9. 3
      oca_dependencies.txt

2
base_phone_popup/__init__.py

@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
from . import popup
from . import models

38
base_phone_popup/__manifest__.py

@ -1,43 +1,17 @@
# -*- coding: utf-8 -*-
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# Copyright 2014-2018 Akretion France
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Base Phone Pop-up',
'version': '9.0.1.0.0',
'version': '10.0.1.0.0',
'category': 'Phone',
'license': 'AGPL-3',
'summary': 'Pop-up the related form view to the user on incoming calls',
'description': """
Base Phone Pop-up
=================
When the user receives a phone call, OpenERP can automatically open the
corresponding partner/lead/employee/... 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/products-and-services/openerp-asterisk-voip-connector
""",
'summary': 'Show a pop-up on incoming calls',
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com/',
'depends': ['base_phone', 'web_action_request'],
'data': ['res_users_view.xml'],
'installable': False,
'depends': ['base_phone', 'web_notify'],
'installable': True,
}

3
base_phone_popup/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import phone_common

37
base_phone_popup/popup.py → base_phone_popup/models/phone_common.py

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# Copyright 2014-2018 Akretion France
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from odoo import api, models, _
import logging
logger = logging.getLogger(__name__)
@ -22,8 +22,7 @@ class PhoneCommon(models.AbstractModel):
'type': 'ir.actions.act_window',
'res_model': record_res[0],
'view_mode': 'form,tree',
'views': [[False, 'form']], # Beurk, but needed
'target': 'new',
'views': [[False, 'form']],
'res_id': record_res[1],
}
else:
@ -32,7 +31,7 @@ class PhoneCommon(models.AbstractModel):
'type': 'ir.actions.act_window',
'res_model': 'number.not.found',
'view_mode': 'form',
'views': [[False, 'form']], # Beurk, but needed
'views': [[False, 'form']],
'target': 'new',
'context': {'default_calling_number': number}
}
@ -44,26 +43,22 @@ class PhoneCommon(models.AbstractModel):
res = self.get_record_from_phone_number(number)
users = self.env['res.users'].search(
[('login', 'in', login_list)])
logger.debug(
'Notify incoming call from number %s to users %s'
logger.info(
'Notify incoming call from number %s to users IDs %s'
% (number, users.ids))
action = self._prepare_incall_pop_action(res, number)
if action:
for user in users:
if user.context_incall_popup:
self.sudo(user.id).env['action.request'].notify(action)
logger.debug(
'This action has been sent to user ID %d: %s'
% (user.id, action))
title = _('Incoming call')
message = _('Call from %s') % number
action_link_name = res and res[2] or action['name']
users.notify_info(
message, title=title, sticky=True, action=action,
action_link_name=action_link_name)
logger.debug(
'This action has been sent to users IDs %s: %s'
% (users.ids, action))
if res:
callerid = res[2]
else:
callerid = False
return callerid
class ResUsers(models.Model):
_inherit = 'res.users'
context_incall_popup = fields.Boolean(
string='Pop-up on Incoming Calls', default=True)

1
base_phone_popup/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Alexis de Lattre <alexis.delattre@akretion.com>

3
base_phone_popup/readme/DESCRIPTION.rst

@ -0,0 +1,3 @@
When the user receives a phone call, Odoo will display a notification
at the top-right of the screen that contains a link to the corresponding
partner/lead/employee/... or a link to the *Number not found* wizard.

1
base_phone_popup/readme/USAGE.rst

@ -0,0 +1 @@
To deploy this feature with an Asterisk-based IPBX, please read this `document <https://akretion.com/en/open-source-contributions/odoo-asterisk-voip-connector>`_.

39
base_phone_popup/res_users_view.xml

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<data>
<record id="view_users_form" model="ir.ui.view">
<field name="name">base_phone_popup.res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base_phone.view_users_form"/>
<field name="arch" type="xml">
<page name="phone" position="attributes">
<attribute name="invisible">0</attribute>
</page>
<group name="phone-preferences" position="inside">
<field name="context_incall_popup"/>
</group>
</field>
</record>
<record id="view_users_form_simple_modif" model="ir.ui.view">
<field name="name">base_phone_popup.users.preferences.view</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base_phone.view_users_form_simple_modif" />
<field name="arch" type="xml">
<group name="phone" position="inside">
<field name="context_incall_popup" readonly="0"/>
</group>
<group name="phone" position="attributes">
<attribute name="invisible">0</attribute>
</group>
</field>
</record>
</data>
</odoo>

3
oca_dependencies.txt

@ -1 +1,2 @@
server-tools
server-tools
web
Loading…
Cancel
Save