Skip to content

Commit

Permalink
[MIG] base_phone_popup
Browse files Browse the repository at this point in the history
  • Loading branch information
murtuzasaleh committed Feb 13, 2024
1 parent 301d9b4 commit 8ed7471
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 111 deletions.
25 changes: 13 additions & 12 deletions base_phone_popup/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand All @@ -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.

Expand All @@ -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.
2 changes: 0 additions & 2 deletions base_phone_popup/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# -*- coding: utf-8 -*-

from . import models
18 changes: 9 additions & 9 deletions base_phone_popup/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Base Phone Pop-up',
'version': '12.0.1.0.0',
'category': 'Phone',
'license': 'AGPL-3',
'summary': 'Pop-up the related form view to the user on incoming calls',
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com/',
'depends': ['base_phone', 'web_notify'],
'installable': True,
"name": "Base Phone Pop-up",
"version": "17.0.1.0.0",
"category": "Phone",
"license": "AGPL-3",
"summary": "Pop-up the related form view to the user on incoming calls",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/connector-telephony",
"depends": ["base_phone", "web_notify"],
"installable": True,
}
4 changes: 1 addition & 3 deletions base_phone_popup/models/__init__.py
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
61 changes: 29 additions & 32 deletions base_phone_popup/models/phone_common.py
Original file line number Diff line number Diff line change
@@ -1,71 +1,68 @@
# -*- 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))
f"Notify incoming call from number {number} to user IDs {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)
logger.debug(
'This action has been sent to user ID %d: %s'
% (user.id, action))
self.sudo().env["bus.bus"].sendone(channel, bus_message)
logger.debug(f"This action has been sent to user ID {user.id} {action}")
if res:
callerid = res[2]
else:
Expand Down
6 changes: 3 additions & 3 deletions base_phone_popup/models/res_users.py
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).
Expand All @@ -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
)
3 changes: 3 additions & 0 deletions base_phone_popup/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions base_phone_popup/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Alexis de Lattre \<<[email protected]>\>
1 change: 0 additions & 1 deletion base_phone_popup/readme/CONTRIBUTORS.rst

This file was deleted.

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.
2 changes: 2 additions & 0 deletions base_phone_popup/readme/USAGE.md
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).
1 change: 0 additions & 1 deletion base_phone_popup/readme/USAGE.rst

This file was deleted.

13 changes: 7 additions & 6 deletions base_phone_popup/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@ <h1 class="title">Base Phone Pop-up</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ec510c031dcf39f8614be3fdcaae8d6837177255ccd70c3dc3f275c44145a2ff
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/connector-telephony/tree/12.0/base_phone_popup"><img alt="OCA/connector-telephony" src="https://img.shields.io/badge/github-OCA%2Fconnector--telephony-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/connector-telephony-12-0/connector-telephony-12-0-base_phone_popup"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/connector-telephony&amp;target_branch=12.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/connector-telephony/tree/17.0/base_phone_popup"><img alt="OCA/connector-telephony" src="https://img.shields.io/badge/github-OCA%2Fconnector--telephony-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/connector-telephony-17-0/connector-telephony-17-0-base_phone_popup"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/connector-telephony&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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 <em>Number not found</em> wizard.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -388,14 +388,15 @@ <h1 class="title">Base Phone Pop-up</h1>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>To deploy this feature with an Asterisk-based IPBX, please read this <a class="reference external" href="https://akretion.com/en/open-source-contributions/odoo-asterisk-voip-connector">document</a>.</p>
<p>To deploy this feature with an Asterisk-based IPBX, please read this
<a class="reference external" href="https://akretion.com/en/open-source-contributions/odoo-asterisk-voip-connector">document</a>.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/connector-telephony/issues">GitHub Issues</a>.
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
<a class="reference external" href="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</a>.</p>
<a class="reference external" href="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**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -419,7 +420,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/connector-telephony/tree/12.0/base_phone_popup">OCA/connector-telephony</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/connector-telephony/tree/17.0/base_phone_popup">OCA/connector-telephony</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
40 changes: 0 additions & 40 deletions base_phone_popup/views/res_users.xml

This file was deleted.

Binary file added pandoc-3.1.11.1-1-amd64.deb
Binary file not shown.

0 comments on commit 8ed7471

Please sign in to comment.