Skip to content

Commit

Permalink
[IMP] base_phone: pre-commit stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikul-OSI committed Feb 12, 2024
1 parent ef62e4b commit 6a1e1bc
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 34 deletions.
36 changes: 22 additions & 14 deletions base_phone/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,29 @@ Base Phone
: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/14.0/base_phone
:target: https://github.com/OCA/connector-telephony/tree/17.0/base_phone
: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-14-0/connector-telephony-14-0-base_phone
:target: https://translation.odoo-community.org/projects/connector-telephony-17-0/connector-telephony-17-0-base_phone
: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=14.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|

This module provides common methods and wizards which can be useful to develop a connector between Odoo and a telephony system. It depends on the official module *phone_validation* which handle the reformatting of phone numbers using the `phonenumbers <https://github.com/daviddrysdale/python-phonenumbers>`_ Python library, which is a port of the library used in Android smartphones. For example, if
your user is linked to a French company and you update the form view of a
partner with a badly written French phone number such as '01-55-42-12-42',
Odoo will automatically update the phone number to `E.164 <https://en.wikipedia.org/wiki/E.164>`_ format '+33155421242'. This module extends this reformatting to create() and write() methods.
This module provides common methods and wizards which can be useful to
develop a connector between Odoo and a telephony system. It depends on
the official module *phone_validation* which handle the reformatting of
phone numbers using the
`phonenumbers <https://github.com/daviddrysdale/python-phonenumbers>`__
Python library, which is a port of the library used in Android
smartphones. For example, if your user is linked to a French company and
you update the form view of a partner with a badly written French phone
number such as '01-55-42-12-42', Odoo will automatically update the
phone number to `E.164 <https://en.wikipedia.org/wiki/E.164>`__ format
'+33155421242'. This module extends this reformatting to create() and
write() methods.

This module is used by the Odoo-Asterisk connector of the OCA.

Expand All @@ -46,26 +54,26 @@ 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%0Aversion:%2014.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%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 <alexis.delattre@akretion.com>
* Sébastien Beau <sebastien.beau@akretion.com>
- Alexis de Lattre <alexis.delattre@akretion.com>
- Sébastien Beau <sebastien.beau@akretion.com>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -85,6 +93,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-alexis-via|

This module is part of the `OCA/connector-telephony <https://github.com/OCA/connector-telephony/tree/14.0/base_phone>`_ project on GitHub.
This module is part of the `OCA/connector-telephony <https://github.com/OCA/connector-telephony/tree/17.0/base_phone>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion base_phone/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{
"name": "Base Phone",
"version": "14.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Phone",
"license": "AGPL-3",
"summary": "Validate phone numbers",
Expand Down
5 changes: 3 additions & 2 deletions base_phone/models/phone_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def get_record_from_phone_number(self, presented_number):
)
if not isinstance(presented_number, str):
_logger.warning(
"Number '%s' should be a 'str' but it is a '%s'"
% (presented_number, type(presented_number))
("Number '{}' should be a 'str' but it is a '{}'").formate(
presented_number, type(presented_number)
)
)
return False
if not presented_number.isdigit():
Expand Down
2 changes: 1 addition & 1 deletion base_phone/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def name_get(self):
res = []
for partner in self:
if partner.parent_id and partner.parent_id.is_company:
name = "{}, {}".format(partner.parent_id.name, partner.name)
name = f"{partner.parent_id.name}, {partner.name}"
else:
name = partner.name
res.append((partner.id, name))
Expand Down
2 changes: 0 additions & 2 deletions base_phone/readme/CONTRIBUTORS.rst

This file was deleted.

6 changes: 0 additions & 6 deletions base_phone/readme/DESCRIPTION.rst

This file was deleted.

22 changes: 15 additions & 7 deletions base_phone/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,19 @@ <h1 class="title">Base Phone</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9f25b9cb743d588b4cbe67f7804ef3aa733902d373f0108b0a1a97f5ac72d0a7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/14.0/base_phone"><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-14-0/connector-telephony-14-0-base_phone"><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=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module provides common methods and wizards which can be useful to develop a connector between Odoo and a telephony system. It depends on the official module <em>phone_validation</em> which handle the reformatting of phone numbers using the <a class="reference external" href="https://github.com/daviddrysdale/python-phonenumbers">phonenumbers</a> Python library, which is a port of the library used in Android smartphones. For example, if
your user is linked to a French company and you update the form view of a
partner with a badly written French phone number such as ‘01-55-42-12-42’,
Odoo will automatically update the phone number to <a class="reference external" href="https://en.wikipedia.org/wiki/E.164">E.164</a> format ‘+33155421242’. This module extends this reformatting to create() and write() methods.</p>
<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"><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"><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>This module provides common methods and wizards which can be useful to
develop a connector between Odoo and a telephony system. It depends on
the official module <em>phone_validation</em> which handle the reformatting of
phone numbers using the
<a class="reference external" href="https://github.com/daviddrysdale/python-phonenumbers">phonenumbers</a>
Python library, which is a port of the library used in Android
smartphones. For example, if your user is linked to a French company and
you update the form view of a partner with a badly written French phone
number such as ‘01-55-42-12-42’, Odoo will automatically update the
phone number to <a class="reference external" href="https://en.wikipedia.org/wiki/E.164">E.164</a> format
‘+33155421242’. This module extends this reformatting to create() and
write() methods.</p>
<p>This module is used by the Odoo-Asterisk connector of the OCA.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -392,7 +400,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">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%0Aversion:%2014.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%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 +427,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/alexis-via"><img alt="alexis-via" src="https://github.com/alexis-via.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/connector-telephony/tree/14.0/base_phone">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">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
2 changes: 1 addition & 1 deletion base_phone/tests/test_base_phone.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class TestBasePhone(TransactionCase):
def setUp(self):
super(TestBasePhone, self).setUp()
super().setUp()
self.fr_country_id = self.env.ref("base.fr").id
self.phco = self.env["phone.common"]
self.env.company.write({"country_id": self.fr_country_id})
Expand Down

0 comments on commit 6a1e1bc

Please sign in to comment.