Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] base_phone: Migration to 18.0 #326

Open
wants to merge 127 commits into
base: 18.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
a6d68d6
Update translation files
OCA-git-bot Jan 31, 2020
715ae45
Extract Asterisk-independant code (the widget="phone" + phone number …
Mar 13, 2014
b424f34
Improve string.
Mar 24, 2014
2b0edc3
Add country on main company as demo data (otherwize it blocks write o…
Jul 5, 2014
1d7845c
Add monkey-patching of format function to add phone=True and phone_fo…
Jul 13, 2014
0064592
Very large changes in the structure of the project :
Jul 27, 2014
dfe84f0
Add semi-column at the end of line in JS code !
Aug 14, 2014
b2e0d82
The "Dial" button is now inside the phone widget : this is great beca…
Aug 20, 2014
3e6b1b7
Update POT file and partial update of FR translation
Aug 21, 2014
a6dac2e
Port to OpenERP v8.0
Aug 21, 2014
70d1ab2
Update PhoneFormat JS lib
Aug 25, 2014
62025ff
Feature "Open Calling Partner" replaced by "Open Caller", with a comp…
Aug 25, 2014
7fa0022
Activate widget on form view of company.
Sep 2, 2014
9bcfc77
Use =like instead of like in phone number search, because I add the '…
Nov 4, 2014
c5f5c20
Fix code style
Nov 5, 2014
cad9ad3
Add widget="phone" in tree view, to have an easy-to-read phone number…
Dec 16, 2014
d29bd70
Start the wizard "Reformat Phone Numbers" after the installation of t…
Dec 26, 2014
b8d91c1
FIX: clear field when number not set rather than leaving previous value
Jan 2, 2015
765b6c0
Fix bug #17: don't raise by default on write/create
Jan 23, 2015
b6f560c
One possible implementation of raise when partner create/write is man…
Jan 24, 2015
28f1fa0
Adapt the reformat_phonenumber_wizard to the new behavior on raise
Jan 24, 2015
43c9c6e
PEP8 fix
Feb 5, 2015
5cbcd0a
base_phone: Add YAML test
Feb 12, 2015
2a6a74c
Update screenshots
Feb 21, 2015
ba5ad1c
Add OCA as author of OCA addons
gurneyalex Mar 2, 2015
36aaabf
Add support for "Create CRM phonecall" on leads (and not only partners)
Mar 12, 2015
151b44b
Fully remove raise from write/create, to avoid a crash on module inst…
Mar 19, 2015
400e31b
If you enter a phone number in national format, it is now interpreted…
Mar 20, 2015
d5e3094
Continue to adapt the code to the recent changes
Mar 20, 2015
a611784
More Yaml tests
Mar 20, 2015
6ffefaf
new: pkg: adds requirements.txt to explicit dependencies and ease scr…
vaab Mar 25, 2015
c8f910a
Slovenian translations added
sysadminmatmoz Apr 5, 2015
f3b4528
edit arguments accordingly to func definition
Apr 9, 2015
2e65f72
Fix bug #40
Apr 14, 2015
f3aa2e6
PEP8 fix
Apr 14, 2015
a0746b5
XML Code clean-up
Apr 14, 2015
b871614
FIX a crash when exception has no len
May 13, 2015
82b7a86
Please welcome the new module ovh_telephony_connector !
May 20, 2015
ddaf7ef
Fix bug #20 Multiple click2dial when previous click2dial failed
Jun 25, 2015
db8dde8
[FIX] set countrycode in upper case to avoid error with the lib phone…
bguillot Sep 29, 2015
63195ee
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
634d387
[MIG] Make modules uninstallable
pedrobaeza Oct 14, 2015
6e8778c
Less verbose logs
guewen Oct 28, 2015
0916282
Do not interpolate directly in logger
guewen Oct 29, 2015
2983652
Fix Nonetype error
guewen Nov 23, 2015
79bb750
FIX avoid phone numbers on 2 lines in tree view
alexis-via Jan 29, 2016
eb1a46b
[FIX] flake8 errors
damdam-s Feb 8, 2016
d3f9cb5
[FIX] move country=FR from demo data to test file
damdam-s Feb 8, 2016
1ecca13
[IMP] Migrate base_phone in 9.0
alexis-via Mar 8, 2016
e235bdc
[IMP] Add README.rst file in base_phone module
Mar 8, 2016
884550d
[IMP] To avoid conflicts, we check that widgets phone and fax do not …
Mar 8, 2016
4db6d2d
[FIX] Fixing issues from travis in base_phone module
Mar 24, 2016
697d5d0
[FIX] Fix problem in point_of_sale with customer editing
Apr 4, 2016
9ca1c42
Add comment to explain the hack for the POS
alexis-via May 19, 2016
1e8669f
Port crm_phone to v9
alexis-via May 19, 2016
3c32e00
Restore the object crm.phonecall that was dropped in v9 community
alexis-via May 23, 2016
a7bfc4f
Started to implement solution d) as discussed in https://github.com/O…
alexis-via Jun 24, 2016
d001e4c
Port YAML tests to new fields.Phone archi
alexis-via Jun 24, 2016
21f30f9
Convert YAML tests to unit-tests, with several improvements
alexis-via Jun 25, 2016
d3f514d
Port the wizard reformat_all_phonenumbers to the new fields.Phone archi
alexis-via Jun 25, 2016
75a0dcf
Phone numbers are now clickable in tree view
alexis-via Jun 26, 2016
ac84ee4
JS code cleanup: no spaces in href links
alexis-via Jun 27, 2016
c617511
Restore click2dial feature
alexis-via Jun 27, 2016
4a06b52
FIX write when input has no_break_space
alexis-via Jun 27, 2016
fc800ed
Avoid a crash if there is a create/write with a wrong field name
alexis-via Jul 5, 2016
4088761
Fix crash in number not found wizard
alexis-via Jul 12, 2016
62892bf
Replace narrow_no_break_space by no_break_space to make it work on ma…
alexis-via Jul 18, 2016
3ba2592
Fix unittest and another attempt at fixing travis
alexis-via Jul 20, 2016
b127d0f
Fix bug #93... but it seems do_notify() is not working in v9 in this …
alexis-via Jul 20, 2016
4d0e94a
Finalise move from narrow-no-break-space to no-break-space
alexis-via Jul 21, 2016
104daf1
[FIX] remove en.po that was erroneously created by transbot
sbidoul Aug 15, 2016
60f006f
[MIG] Make modules uninstallable
pedrobaeza Oct 6, 2016
6c26195
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
10204f0
[MIG] Migrated base_phone to v10.0 (#107)
Oct 17, 2016
24f3460
[FIX] We must now inherit from the base model, instead of monkey-patc…
Nov 8, 2016
220ec00
Port crm_phone, hr_phone, hr_recruitment_phone, event_phone to v10
alexis-via Oct 28, 2016
9aaba7b
[FIX] base_phone: Fixed click2dial feature
Nov 4, 2016
11caa36
Make click2dial work in real life
alexis-via Nov 8, 2016
4775099
Restore fix for partner creation from POS bug #113
alexis-via Nov 9, 2016
d2b5a85
Fix bug #117 CSV import is now working, with the kind help of Sylvain…
alexis-via Dec 6, 2016
0aa37ad
Use config page instead of company form view
alexis-via Jun 22, 2017
b958f01
[Odoo 10] Fix for #20
sadasant Jan 17, 2018
e75379c
remove obsolete .pot files [ci skip]
sbidoul Jun 15, 2018
be42c0f
Port to v12 base_phone, asterisk_click2dial, crm_phone, hr_phone, eve…
alexis-via Nov 15, 2018
a50a924
[ADD] icon.png
OCA-git-bot Apr 3, 2019
0119cb0
Translated using Weblate (Spanish)
mvrodriguez Feb 7, 2019
9f7ca47
Forward port dial button refactor from v11 to v12
alexis-via May 28, 2019
363ed5f
Add reformatting of phone numbers on res.partner in base_phone
alexis-via May 29, 2019
d196b7d
base_phone: Fix layout of General Settings page
alexis-via Jul 10, 2019
69fc874
Translated using Weblate (Portuguese (Brazil))
Sep 2, 2019
6a67dbe
Translated using Weblate (Portuguese (Brazil))
Sep 2, 2019
c773572
[IMP] base_phone : (refactoring) remove controller
Jun 9, 2020
1cd7c6d
[IMP] base_phone: black, isort, prettier
mimusica Jul 31, 2020
3aaa4e8
[MIG] base_phone: Migration to 13.0
mimusica Aug 1, 2020
d9d2fdf
[UPD] Update base_phone.pot
oca-travis Dec 2, 2020
e0e4b57
[IMP] base_phone: black, isort, prettier
May 4, 2021
bfcdc73
[MIG] base_phone: Migration to 14.0
May 4, 2021
ff74294
Add missing access on wizards
florian-dacosta May 10, 2021
3b1f48d
bsae_phone: FIX method get_record_from_phone_number()
alexis-via May 12, 2021
2fb8427
base_phone: add unit tests
alexis-via May 15, 2021
1eec92c
base_phone: avoid a warning in the number not found wizard
alexis-via May 18, 2021
9a51fc0
[UPD] Update base_phone.pot
oca-travis May 18, 2021
5a10118
[UPD] README.rst
OCA-git-bot May 18, 2021
97fb9ff
[FIX] We have to stay on the same page after clicking on the link
cvinh Sep 21, 2021
e156c91
Added translation using Weblate (Spanish (Argentina))
nimarosa Aug 5, 2022
473903d
Translated using Weblate (Spanish (Argentina))
nimarosa Aug 5, 2022
006be8d
Translated using Weblate (French)
klodr Sep 17, 2022
cca5621
Translated using Weblate (Italian)
mymage Mar 30, 2023
056df74
Translated using Weblate (Slovenian)
sysadminmatmoz Mar 31, 2023
2f12d60
[UPD] README.rst
OCA-git-bot Sep 3, 2023
98cf5c3
Update translation files
weblate Oct 10, 2023
7e98c86
Translated using Weblate (Spanish)
Ivorra78 Dec 20, 2023
b6387ac
[MIG] base_phone: Migration to 15.0
aiendry-aktivsoftware May 1, 2023
a1b3c30
[IMP] base_phone: pre-commit auto fixes
luisDIXMIT Apr 3, 2024
f6ff1f1
[MIG] base_phone: Migration to 17.0
luisDIXMIT Apr 3, 2024
bd936b2
[UPD] Update base_phone.pot
Apr 4, 2024
f6a19fc
[BOT] post-merge updates
OCA-git-bot Apr 4, 2024
e349277
Update translation files
weblate Apr 4, 2024
b84019f
Translated using Weblate (Italian)
mymage Apr 5, 2024
c7f7247
Translated using Weblate (Italian)
mymage Apr 23, 2024
e087dbb
Translated using Weblate (Spanish)
Ivorra78 Apr 24, 2024
70249ab
[FIX] base_phone: Line too long
pedrobaeza May 2, 2024
4eb80c8
[BOT] post-merge updates
OCA-git-bot May 2, 2024
ebdca3a
Translated using Weblate (Italian)
mymage Aug 26, 2024
576ae14
Translated using Weblate (Italian)
mymage Oct 15, 2024
efa249d
[IMP] base_phone: pre-commit auto fixes
HeliconiaSolutions Nov 28, 2024
ce5b9d6
[MIG] base_phone: Migration to 18.0
HeliconiaSolutions Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
base_phone: add unit tests
  • Loading branch information
alexis-via authored and HeliconiaSolutions committed Nov 28, 2024
commit 2fb84276d5b58f173da3f05a50a4f7b92d6a89a6
2 changes: 1 addition & 1 deletion base_phone/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -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.name, partner.parent_id.name)
name = "{}, {}".format(partner.parent_id.name, partner.name)
else:
name = partner.name
res.append((partner.id, name))
1 change: 1 addition & 0 deletions base_phone/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_base_phone
107 changes: 107 additions & 0 deletions base_phone/tests/test_base_phone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Copyright 2021 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase


class TestBasePhone(TransactionCase):
def setUp(self):
super(TestBasePhone, self).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})
self.akretion = self.env["res.partner"].create(
{
"name": "Akretion France",
"country_id": self.fr_country_id,
"phone": "+33 4 78 32 32 32",
}
)

def test_get_phone_model(self):
res = self.phco._get_phone_models()
self.assertIsInstance(res, list)
rpo = self.env["res.partner"]
self.assertTrue(any([x["object"] == rpo for x in res]))
for entry in res:
self.assertIsInstance(entry.get("fields"), list)

def test_lookup(self):
res = self.phco.get_record_from_phone_number("0478323232")
self.assertIsInstance(res, tuple)
self.assertEqual(res[0], "res.partner")
self.assertEqual(res[1], self.akretion.id)
self.assertEqual(
res[2], self.akretion.with_context(callerid=True).name_get()[0][1]
)
res = self.phco.get_record_from_phone_number("0499889988")
self.assertFalse(res)

def test_to_dial(self):
phone_to_dial = self.phco.convert_to_dial_number("+33 4 78 99 88 77")
self.assertEqual(phone_to_dial, "0478998877")
phone_to_dial = self.phco.convert_to_dial_number("+32 455 78 99 88")
self.assertEqual(phone_to_dial, "0032455789988")

def test_partner_phone_formatting(self):
rpo = self.env["res.partner"]
# Create an existing partner without country
partner1 = rpo.create(
{
"name": "Pierre Paillet",
"phone": "04-72-08-87-32",
"mobile": "06.42.77.42.66",
}
)
partner1._onchange_phone_validation()
partner1._onchange_mobile_validation()
self.assertEqual(partner1.phone, "+33 4 72 08 87 32")
self.assertEqual(partner1.mobile, "+33 6 42 77 42 66")
# Create a partner with country
parent_partner2 = rpo.create(
{
"name": "C2C",
"country_id": self.env.ref("base.ch").id,
"is_company": True,
}
)
partner2 = rpo.create(
{
"name": "Joël Grand-Guillaume",
"parent_id": parent_partner2.id,
"phone": "(0) 21 619 10 10",
"mobile": "(0) 79 606 42 42",
}
)
partner2._onchange_phone_validation()
partner2._onchange_mobile_validation()
self.assertEqual(partner2.country_id, self.env.ref("base.ch"))
self.assertEqual(partner2.phone, "+41 21 619 10 10")
self.assertEqual(partner2.mobile, "+41 79 606 42 42")
# Write on an existing partner
partner3 = rpo.create(
{
"name": "Belgian corp",
"country_id": self.env.ref("base.be").id,
"is_company": True,
}
)
partner3.write({"phone": "(0) 2 391 43 74"})
partner3._onchange_phone_validation()
self.assertEqual(partner3.phone, "+32 2 391 43 74")
# Write on an existing partner with country at the same time
partner3.write(
{
"phone": "04 72 89 32 43",
"country_id": self.fr_country_id,
}
)
partner3._onchange_phone_validation()
self.assertEqual(partner3.phone, "+33 4 72 89 32 43")
# Test get_name_from_phone_number
pco = self.env["phone.common"]
name = pco.get_name_from_phone_number("0642774266")
self.assertEqual(name, "Pierre Paillet")
name2 = pco.get_name_from_phone_number("0041216191010")
self.assertEqual(name2, "C2C, Joël Grand-Guillaume")