-
-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
301d9b4
commit e71754f
Showing
14 changed files
with
75 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,19 +17,19 @@ Base Phone Pop-up | |
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fconnector--telephony-lightgray.png?logo=github | ||
:target: https://github.com/OCA/connector-telephony/tree/12.0/base_phone_popup | ||
:target: https://github.com/OCA/connector-telephony/tree/17.0/base_phone_popup | ||
:alt: OCA/connector-telephony | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/connector-telephony-12-0/connector-telephony-12-0-base_phone_popup | ||
:target: https://translation.odoo-community.org/projects/connector-telephony-17-0/connector-telephony-17-0-base_phone_popup | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/connector-telephony&target_branch=12.0 | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/connector-telephony&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
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 | ||
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. | ||
|
||
**Table of contents** | ||
|
@@ -40,33 +40,34 @@ partner/lead/employee/... or a link to the *Number not found* wizard. | |
Usage | ||
===== | ||
|
||
To deploy this feature with an Asterisk-based IPBX, please read this `document <https://akretion.com/en/open-source-contributions/odoo-asterisk-voip-connector>`_. | ||
To deploy this feature with an Asterisk-based IPBX, please read this | ||
`document <https://akretion.com/en/open-source-contributions/odoo-asterisk-voip-connector>`__. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-telephony/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/connector-telephony/issues/new?body=module:%20base_phone_popup%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
`feedback <https://github.com/OCA/connector-telephony/issues/new?body=module:%20base_phone_popup%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
------- | ||
|
||
* Akretion | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
------------ | ||
|
||
* Alexis de Lattre <[email protected]> | ||
- Alexis de Lattre <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
|
@@ -78,6 +79,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose | |
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
This module is part of the `OCA/connector-telephony <https://github.com/OCA/connector-telephony/tree/12.0/base_phone_popup>`_ project on GitHub. | ||
This module is part of the `OCA/connector-telephony <https://github.com/OCA/connector-telephony/tree/17.0/base_phone_popup>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import phone_common | ||
#from . import res_users | ||
# from . import res_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,70 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2014-2018 Akretion France | ||
# @author: Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, models, _ | ||
from odoo.addons.web.controllers.main import clean_action | ||
import logging | ||
|
||
from odoo import _, api, models | ||
|
||
from odoo.addons.web.controllers.main import clean_action | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class PhoneCommon(models.AbstractModel): | ||
_inherit = 'phone.common' | ||
_inherit = "phone.common" | ||
|
||
@api.model | ||
def _prepare_incall_pop_action(self, record_res, number): | ||
action = False | ||
if record_res: | ||
obj = self.env[record_res[0]] | ||
action = { | ||
'name': obj._description, | ||
'type': 'ir.actions.act_window', | ||
'res_model': record_res[0], | ||
'view_mode': 'form,tree', | ||
'views': [[False, 'form']], | ||
"name": obj._description, | ||
"type": "ir.actions.act_window", | ||
"res_model": record_res[0], | ||
"view_mode": "form,tree", | ||
"views": [[False, "form"]], | ||
# 'target': 'new', | ||
'res_id': record_res[1], | ||
} | ||
"res_id": record_res[1], | ||
} | ||
else: | ||
action = { | ||
'name': _('Number Not Found'), | ||
'type': 'ir.actions.act_window', | ||
'res_model': 'number.not.found', | ||
'view_mode': 'form', | ||
'views': [[False, 'form']], | ||
"name": _("Number Not Found"), | ||
"type": "ir.actions.act_window", | ||
"res_model": "number.not.found", | ||
"view_mode": "form", | ||
"views": [[False, "form"]], | ||
# 'target': 'new', | ||
'context': {'default_calling_number': number} | ||
"context": {"default_calling_number": number}, | ||
} | ||
return action | ||
|
||
@api.model | ||
def incall_notify_by_login(self, number, login_list): | ||
assert isinstance(login_list, list), 'login_list must be a list' | ||
assert isinstance(login_list, list), "login_list must be a list" | ||
res = self.get_record_from_phone_number(number) | ||
users = self.env['res.users'].search( | ||
[('login', 'in', login_list)]) | ||
users = self.env["res.users"].search([("login", "in", login_list)]) | ||
logger.info( | ||
'Notify incoming call from number %s to user IDs %s' | ||
% (number, users.ids)) | ||
"Notify incoming call from number %s to user IDs %s" % (number, users.ids) | ||
) | ||
action = self._prepare_incall_pop_action(res, number) | ||
action = clean_action(action) | ||
if action: | ||
for user in users: | ||
channel = 'notify_info_%s' % user.id | ||
channel = "notify_info_%s" % user.id | ||
bus_message = { | ||
'message': _('Here is my message'), | ||
'title': _('Incoming call'), | ||
'action': action, | ||
"message": _("Here is my message"), | ||
"title": _("Incoming call"), | ||
"action": action, | ||
# 'sticky': True, | ||
'action_link_name': 'action_link_name', | ||
"action_link_name": "action_link_name", | ||
} | ||
|
||
self.sudo().env['bus.bus'].sendone( | ||
channel, bus_message) | ||
self.sudo().env["bus.bus"].sendone(channel, bus_message) | ||
logger.debug( | ||
'This action has been sent to user ID %d: %s' | ||
% (user.id, action)) | ||
"This action has been sent to user ID %d: %s" % (user.id, action) | ||
) | ||
if res: | ||
callerid = res[2] | ||
else: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2014-2018 Akretion France | ||
# @author: Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
@@ -7,7 +6,8 @@ | |
|
||
|
||
class ResUsers(models.Model): | ||
_inherit = 'res.users' | ||
_inherit = "res.users" | ||
|
||
context_incall_popup = fields.Boolean( | ||
string='Pop-up on Incoming Calls', default=True) | ||
string="Pop-up on Incoming Calls", default=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Alexis de Lattre \<<[email protected]>\> |
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
base_phone_popup/readme/DESCRIPTION.rst → base_phone_popup/readme/DESCRIPTION.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +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 | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
To deploy this feature with an Asterisk-based IPBX, please read this | ||
[document](https://akretion.com/en/open-source-contributions/odoo-asterisk-voip-connector). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
Copyright 2014-2018 Akretion France | ||
@author: Alexis de Lattre <[email protected]> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
--> | ||
|
||
<odoo> | ||
|
||
|
||
<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="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"/> | ||
<field name="context_incall_popup" /> | ||
</group> | ||
</field> | ||
</record> | ||
|
@@ -28,7 +27,7 @@ | |
<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"/> | ||
<field name="context_incall_popup" readonly="0" /> | ||
</group> | ||
<group name="phone" position="attributes"> | ||
<attribute name="invisible">0</attribute> | ||
|