From e71754f79d87cdec863d29de045cfa08a614e2e2 Mon Sep 17 00:00:00 2001 From: Murtuza Saleh Date: Tue, 13 Feb 2024 15:32:28 +0530 Subject: [PATCH] [FIX] pre-commit --- base_phone_popup/README.rst | 25 ++++---- base_phone_popup/__init__.py | 2 - base_phone_popup/__manifest__.py | 18 +++--- base_phone_popup/models/__init__.py | 4 +- base_phone_popup/models/phone_common.py | 61 +++++++++---------- base_phone_popup/models/res_users.py | 6 +- base_phone_popup/pyproject.toml | 3 + base_phone_popup/readme/CONTRIBUTORS.md | 1 + base_phone_popup/readme/CONTRIBUTORS.rst | 1 - .../{DESCRIPTION.rst => DESCRIPTION.md} | 4 +- base_phone_popup/readme/USAGE.md | 2 + base_phone_popup/readme/USAGE.rst | 1 - .../static/description/index.html | 13 ++-- base_phone_popup/views/res_users.xml | 9 ++- 14 files changed, 75 insertions(+), 75 deletions(-) create mode 100644 base_phone_popup/pyproject.toml create mode 100644 base_phone_popup/readme/CONTRIBUTORS.md delete mode 100644 base_phone_popup/readme/CONTRIBUTORS.rst rename base_phone_popup/readme/{DESCRIPTION.rst => DESCRIPTION.md} (62%) create mode 100644 base_phone_popup/readme/USAGE.md delete mode 100644 base_phone_popup/readme/USAGE.rst diff --git a/base_phone_popup/README.rst b/base_phone_popup/README.rst index 79e9441a4..f505070c2 100644 --- a/base_phone_popup/README.rst +++ b/base_phone_popup/README.rst @@ -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,7 +40,8 @@ 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 `_. +To deploy this feature with an Asterisk-based IPBX, please read this +`document `__. Bug Tracker =========== @@ -48,7 +49,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -56,17 +57,17 @@ Credits ======= Authors -~~~~~~~ +------- * Akretion Contributors -~~~~~~~~~~~~ +------------ -* Alexis de Lattre +- Alexis de Lattre 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 `_ project on GitHub. +This module is part of the `OCA/connector-telephony `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_phone_popup/__init__.py b/base_phone_popup/__init__.py index cde864bae..0650744f6 100644 --- a/base_phone_popup/__init__.py +++ b/base_phone_popup/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import models diff --git a/base_phone_popup/__manifest__.py b/base_phone_popup/__manifest__.py index 8acdc4955..f76d2d51c 100644 --- a/base_phone_popup/__manifest__.py +++ b/base_phone_popup/__manifest__.py @@ -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, } diff --git a/base_phone_popup/models/__init__.py b/base_phone_popup/models/__init__.py index 14651d7a3..e32ea8bad 100644 --- a/base_phone_popup/models/__init__.py +++ b/base_phone_popup/models/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- - from . import phone_common -#from . import res_users +# from . import res_users diff --git a/base_phone_popup/models/phone_common.py b/base_phone_popup/models/phone_common.py index 280285ef6..80a36d754 100644 --- a/base_phone_popup/models/phone_common.py +++ b/base_phone_popup/models/phone_common.py @@ -1,17 +1,18 @@ -# -*- coding: utf-8 -*- # Copyright 2014-2018 Akretion France # @author: Alexis de Lattre # 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): @@ -19,53 +20,51 @@ def _prepare_incall_pop_action(self, record_res, number): 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: diff --git a/base_phone_popup/models/res_users.py b/base_phone_popup/models/res_users.py index c4205770a..c1dcb14d7 100644 --- a/base_phone_popup/models/res_users.py +++ b/base_phone_popup/models/res_users.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2014-2018 Akretion France # @author: Alexis de Lattre # 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 + ) diff --git a/base_phone_popup/pyproject.toml b/base_phone_popup/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/base_phone_popup/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/base_phone_popup/readme/CONTRIBUTORS.md b/base_phone_popup/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..b61afe5d0 --- /dev/null +++ b/base_phone_popup/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Alexis de Lattre \<\> diff --git a/base_phone_popup/readme/CONTRIBUTORS.rst b/base_phone_popup/readme/CONTRIBUTORS.rst deleted file mode 100644 index ff65d68ce..000000000 --- a/base_phone_popup/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1 +0,0 @@ -* Alexis de Lattre diff --git a/base_phone_popup/readme/DESCRIPTION.rst b/base_phone_popup/readme/DESCRIPTION.md similarity index 62% rename from base_phone_popup/readme/DESCRIPTION.rst rename to base_phone_popup/readme/DESCRIPTION.md index b2c7dfa58..8501a8415 100644 --- a/base_phone_popup/readme/DESCRIPTION.rst +++ b/base_phone_popup/readme/DESCRIPTION.md @@ -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. diff --git a/base_phone_popup/readme/USAGE.md b/base_phone_popup/readme/USAGE.md new file mode 100644 index 000000000..298a8839f --- /dev/null +++ b/base_phone_popup/readme/USAGE.md @@ -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). diff --git a/base_phone_popup/readme/USAGE.rst b/base_phone_popup/readme/USAGE.rst deleted file mode 100644 index 46522e6e5..000000000 --- a/base_phone_popup/readme/USAGE.rst +++ /dev/null @@ -1 +0,0 @@ -To deploy this feature with an Asterisk-based IPBX, please read this `document `_. diff --git a/base_phone_popup/static/description/index.html b/base_phone_popup/static/description/index.html index 766765c8a..b8495e4e9 100644 --- a/base_phone_popup/static/description/index.html +++ b/base_phone_popup/static/description/index.html @@ -369,9 +369,9 @@

Base Phone Pop-up

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:ec510c031dcf39f8614be3fdcaae8d6837177255ccd70c3dc3f275c44145a2ff !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/connector-telephony Translate me on Weblate Try me on Runboat

-

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 +

Beta License: AGPL-3 OCA/connector-telephony Translate me on Weblate Try me on Runboat

+

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

@@ -388,14 +388,15 @@

Base Phone Pop-up

Usage

-

To deploy this feature with an Asterisk-based IPBX, please read this document.

+

To deploy this feature with an Asterisk-based IPBX, please read this +document.

Bug Tracker

Bugs are tracked on GitHub 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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -419,7 +420,7 @@

Maintainers

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 project on GitHub.

+

This module is part of the OCA/connector-telephony project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/base_phone_popup/views/res_users.xml b/base_phone_popup/views/res_users.xml index f4da093cc..df121b3df 100644 --- a/base_phone_popup/views/res_users.xml +++ b/base_phone_popup/views/res_users.xml @@ -1,23 +1,22 @@ - + - base_phone_popup.res.users.form res.users - + 0 - + @@ -28,7 +27,7 @@ - + 0