Compare commits
32 Commits
Author | SHA1 | Message | Date |
---|---|---|---|
OCA Transbot | 4f82a2171c |
Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: connector-telephony-11.0/connector-telephony-11.0-event_phone Translate-URL: https://translation.odoo-community.org/projects/connector-telephony-11-0/connector-telephony-11-0-event_phone/ |
5 years ago |
OCA-git-bot | 128c0da4b4 |
[ADD] icon.png
|
5 years ago |
OCA Transbot | 9779887297 |
Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: connector-telephony-11.0/connector-telephony-11.0-crm_phone Translate-URL: https://translation.odoo-community.org/projects/connector-telephony-11-0/connector-telephony-11-0-crm_phone/ |
5 years ago |
OCA Transbot | f4a2b1daff |
Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: connector-telephony-11.0/connector-telephony-11.0-base_phone Translate-URL: https://translation.odoo-community.org/projects/connector-telephony-11-0/connector-telephony-11-0-base_phone/ |
5 years ago |
OCA Transbot | 4fdaa0d97e |
Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: connector-telephony-11.0/connector-telephony-11.0-asterisk_click2dial Translate-URL: https://translation.odoo-community.org/projects/connector-telephony-11-0/connector-telephony-11-0-asterisk_click2dial/ |
5 years ago |
oca-travis | 6d48657412 |
[UPD] Update hr_recruitment_phone.pot
|
5 years ago |
oca-travis | 8e3121550f |
[UPD] Update hr_phone.pot
|
5 years ago |
oca-travis | b55451c2fd |
[UPD] Update event_phone.pot
|
5 years ago |
oca-travis | 2099d073f1 |
[UPD] Update crm_phone.pot
|
5 years ago |
oca-travis | 47eef37849 |
[UPD] Update base_phone.pot
|
5 years ago |
oca-travis | 535fc382aa |
[UPD] Update asterisk_click2dial.pot
|
5 years ago |
Alexis de Lattre |
a0735a5f31
|
Merge pull request #180 from akretion/11-imp-base_phone_click2dial
[11.0] Restore Dial button for click2dial |
5 years ago |
Alexis de Lattre | 6f47a6f08a |
Fix odoo version in travis config
Continue to remove dep on demo data in tests |
5 years ago |
Alexis de Lattre | 89d34feef0 |
Don't use a demo partner in test (this partner was removed in later versions)
|
5 years ago |
Alexis de Lattre | 7f42c50de3 |
Move tests from base_phone to crm_phone (to benefit from crm_phone_validation)
|
5 years ago |
Alexis de Lattre | 91637fd0cf |
Improve style of Dial button
Improve messages in notification pop-up Fix short disconnect upon click2dial Add active button for asterisk.server form view Fix add call in CRM wizard |
5 years ago |
hparfr | 21dbdb65f8 |
Refactor dial button
|
5 years ago |
hparfr | c109f32a67 |
Refactor dial button
|
5 years ago |
OCA Transbot | 9ef0064634 |
Update translation files
Updated by Update PO files to match POT (msgmerge) hook in Weblate. |
6 years ago |
OCA Transbot | 8ba32b48b2 |
Update translation files
Updated by Update PO files to match POT (msgmerge) hook in Weblate. |
6 years ago |
OCA Transbot | 314893da33 |
Update translation files
Updated by Update PO files to match POT (msgmerge) hook in Weblate. |
6 years ago |
OCA Transbot | 99f1b74e38 |
Update translation files
Updated by Update PO files to match POT (msgmerge) hook in Weblate. |
6 years ago |
oca-travis | 7f63fcc6d2 |
[UPD] Update hr_recruitment_phone.pot
|
6 years ago |
oca-travis | 6006a5330c |
[UPD] Update hr_phone.pot
|
6 years ago |
oca-travis | 81145310d8 |
[UPD] Update event_phone.pot
|
6 years ago |
oca-travis | c7fafaea4d |
[UPD] Update crm_phone.pot
|
6 years ago |
oca-travis | edaeddb75b |
[UPD] Update base_phone.pot
|
6 years ago |
oca-travis | 8084e2d510 |
[UPD] Update asterisk_click2dial.pot
|
6 years ago |
OCA-git-bot | 8d4a161cc0 |
[ADD] setup.py
|
6 years ago |
Stéphane Bidoul (ACSONE) |
448b9ee925
|
sms_send_picking is not migrated
|
6 years ago |
Stéphane Bidoul (ACSONE) |
3d13bbd48c
|
[ADD] setup.py
|
6 years ago |
Alexis de Lattre | 543159fe89 |
Backport main modules from v12 to v11 (base_phone, crm_phone, hr_phone, event_phone, hr_recruitment_phone, asterisk_click2dial)
|
6 years ago |
-
2.travis.yml
-
4README.md
-
5asterisk_click2dial/__manifest__.py
-
94asterisk_click2dial/i18n/am.po
-
95asterisk_click2dial/i18n/asterisk_click2dial.pot
-
94asterisk_click2dial/i18n/bg.po
-
94asterisk_click2dial/i18n/ca.po
-
97asterisk_click2dial/i18n/de.po
-
94asterisk_click2dial/i18n/el_GR.po
-
106asterisk_click2dial/i18n/es.po
-
94asterisk_click2dial/i18n/es_ES.po
-
94asterisk_click2dial/i18n/fi.po
-
103asterisk_click2dial/i18n/fr.po
-
94asterisk_click2dial/i18n/gl.po
-
94asterisk_click2dial/i18n/hr.po
-
94asterisk_click2dial/i18n/it.po
-
94asterisk_click2dial/i18n/pt.po
-
94asterisk_click2dial/i18n/pt_BR.po
-
94asterisk_click2dial/i18n/pt_PT.po
-
97asterisk_click2dial/i18n/sl.po
-
103asterisk_click2dial/i18n/tr.po
-
12asterisk_click2dial/scripts/set_name_agi.py
-
0asterisk_click2dial/static/src/css/asterisk.css
-
28asterisk_click2dial/static/src/js/asterisk_click2dial.js
-
10asterisk_click2dial/views/asterisk_server.xml
-
9asterisk_click2dial/views/web_asterisk_click2dial.xml
-
2base_phone/__manifest__.py
-
75base_phone/common.py
-
61base_phone/fields.py
-
71base_phone/i18n/am.po
-
71base_phone/i18n/ar.po
-
71base_phone/i18n/base_phone.pot
-
71base_phone/i18n/ca.po
-
71base_phone/i18n/cs.po
-
97base_phone/i18n/de.po
-
71base_phone/i18n/el_GR.po
-
106base_phone/i18n/es.po
-
71base_phone/i18n/es_CR.po
-
71base_phone/i18n/es_EC.po
-
71base_phone/i18n/es_ES.po
-
71base_phone/i18n/es_MX.po
-
71base_phone/i18n/es_VE.po
-
71base_phone/i18n/et.po
-
71base_phone/i18n/fi.po
-
97base_phone/i18n/fr.po
-
71base_phone/i18n/gl.po
-
71base_phone/i18n/hr.po
-
71base_phone/i18n/it.po
-
71base_phone/i18n/lt.po
-
71base_phone/i18n/nl.po
-
71base_phone/i18n/nl_BE.po
-
71base_phone/i18n/pl.po
-
71base_phone/i18n/pt.po
-
71base_phone/i18n/pt_BR.po
-
71base_phone/i18n/pt_PT.po
-
71base_phone/i18n/ro.po
-
71base_phone/i18n/ru.po
-
97base_phone/i18n/sl.po
-
71base_phone/i18n/th.po
-
100base_phone/i18n/tr.po
-
71base_phone/i18n/vi.po
-
31base_phone/models/base.py
-
17base_phone/models/ir_fields_converter.py
-
9base_phone/models/phone_common.py
-
5base_phone/models/phone_validation_mixin.py
-
BINbase_phone/static/description/icon.png
-
156base_phone/static/src/js/phone_widget.js
-
3base_phone/tests/__init__.py
-
69base_phone/tests/test_phone.py
-
2base_phone/wizard/reformat_all_phonenumbers.py
-
0base_phone_popup/models/phone_common.py
-
0base_phone_popup/views/res_users.xml
-
2crm_phone/__manifest__.py
-
68crm_phone/i18n/am.po
-
68crm_phone/i18n/bg.po
-
68crm_phone/i18n/ca.po
-
70crm_phone/i18n/crm_phone.pot
-
76crm_phone/i18n/de.po
-
68crm_phone/i18n/el_GR.po
-
84crm_phone/i18n/es.po
-
68crm_phone/i18n/es_ES.po
-
68crm_phone/i18n/fi.po
-
104crm_phone/i18n/fr.po
-
68crm_phone/i18n/gl.po
-
68crm_phone/i18n/it.po
-
68crm_phone/i18n/pt.po
-
68crm_phone/i18n/pt_BR.po
-
68crm_phone/i18n/pt_PT.po
-
104crm_phone/i18n/sl.po
-
110crm_phone/i18n/tr.po
-
BINcrm_phone/static/description/icon.png
-
82crm_phone/tests/test_crm_phone.py
-
5crm_phone/wizard/create_crm_phonecall.py
-
2event_phone/__manifest__.py
-
2event_phone/i18n/event_phone.pot
-
BINevent_phone/static/description/icon.png
-
2hr_phone/__manifest__.py
-
2hr_phone/i18n/hr_phone.pot
-
BINhr_phone/static/description/icon.png
-
5hr_recruitment_phone/__manifest__.py
@ -1,75 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
# © 2016 Akretion (http://www.akretion.com) |
|
||||
# Sébastien BEAU <sebastien.beau@akretion.com> |
|
||||
# Alexis de Lattre <alexis.delattre@akretion.com> |
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
|
|
||||
|
|
||||
from . import fields as phone_fields |
|
||||
import logging |
|
||||
_logger = logging.getLogger(__name__) |
|
||||
|
|
||||
try: |
|
||||
import phonenumbers |
|
||||
except ImportError: |
|
||||
_logger.debug('Cannot `import phonenumbers`.') |
|
||||
|
|
||||
|
|
||||
def convert_phone_field(value, country_code): |
|
||||
_logger.debug( |
|
||||
'convert_phone_field value=%s country=%s', value, country_code) |
|
||||
try: |
|
||||
res_parse = phonenumbers.parse( |
|
||||
value, country_code) |
|
||||
_logger.debug('res_parse=%s', res_parse) |
|
||||
new_value = phonenumbers.format_number( |
|
||||
res_parse, phonenumbers.PhoneNumberFormat.E164) |
|
||||
_logger.debug('new_value=%s', new_value) |
|
||||
except: |
|
||||
_logger.error( |
|
||||
"Cannot reformat the phone number '%s' to " |
|
||||
"international format with region=%s", |
|
||||
value, country_code) |
|
||||
new_value = value |
|
||||
return new_value |
|
||||
|
|
||||
|
|
||||
def convert_all_phone_fields(self, vals, fields_to_convert): |
|
||||
loc_vals = vals.copy() |
|
||||
for field in fields_to_convert: |
|
||||
country_key = self._fields[field].country_field |
|
||||
partner_key = self._fields[field].partner_field |
|
||||
country = False |
|
||||
if country_key: |
|
||||
if country_key in loc_vals: |
|
||||
# Warning: when we edit or create a partner from the |
|
||||
# POS frontend vals[country_key] is a string ! |
|
||||
country = self.env['res.country'].browse( |
|
||||
int(vals[country_key])) |
|
||||
else: |
|
||||
country = self[country_key] |
|
||||
if partner_key and not country: |
|
||||
if partner_key in loc_vals: |
|
||||
partner = self.env['res.partner'].browse( |
|
||||
int(vals[partner_key])) |
|
||||
else: |
|
||||
partner = self[partner_key] |
|
||||
if partner: |
|
||||
country = partner.country_id |
|
||||
if not country: |
|
||||
country = self.env.user.company_id.country_id |
|
||||
country_code = False |
|
||||
if country: |
|
||||
country_code = country.code.upper() |
|
||||
if loc_vals[field]: |
|
||||
loc_vals[field] = convert_phone_field( |
|
||||
loc_vals[field], country_code) |
|
||||
return loc_vals |
|
||||
|
|
||||
|
|
||||
def get_phone_fields(self, vals): |
|
||||
fields_to_convert = [] |
|
||||
for key in vals: |
|
||||
if isinstance(self._fields.get(key), phone_fields.Fax): |
|
||||
fields_to_convert.append(key) |
|
||||
return fields_to_convert |
|
@ -1,61 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
# © 2016 Akretion (http://www.akretion.com) |
|
||||
# Sébastien BEAU <sebastien.beau@akretion.com> |
|
||||
# Alexis de Lattre <alexis.delattre@akretion.com> |
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
|
|
||||
|
|
||||
from odoo import fields |
|
||||
from operator import attrgetter |
|
||||
import logging |
|
||||
_logger = logging.getLogger(__name__) |
|
||||
|
|
||||
try: |
|
||||
import phonenumbers |
|
||||
except ImportError: |
|
||||
_logger.debug('Cannot `import phonenumbers`.') |
|
||||
|
|
||||
|
|
||||
class Fax(fields.Char): |
|
||||
type = 'fax' |
|
||||
|
|
||||
_slots = { |
|
||||
'country_field': None, |
|
||||
'partner_field': None, |
|
||||
} |
|
||||
|
|
||||
def __init__( |
|
||||
self, string=fields.Default, country_field=fields.Default, |
|
||||
partner_field=fields.Default, **kwargs): |
|
||||
super(Fax, self).__init__( |
|
||||
string=string, country_field=country_field, |
|
||||
partner_field=partner_field, **kwargs) |
|
||||
|
|
||||
_related_country_field = property(attrgetter('country_field')) |
|
||||
_related_partner_field = property(attrgetter('partner_field')) |
|
||||
|
|
||||
def _setup_regular_full(self, model): |
|
||||
super(Fax, self)._setup_regular_full(model) |
|
||||
assert self.country_field in model._fields or \ |
|
||||
self.partner_field in model._fields, \ |
|
||||
"field %s with unknown country_field and partner_field" % self |
|
||||
|
|
||||
def convert_to_cache(self, value, record, validate=True): |
|
||||
res = super(Fax, self).convert_to_cache( |
|
||||
value, record, validate=validate) |
|
||||
# print 'db value', res |
|
||||
if res: |
|
||||
try: |
|
||||
res_parse = phonenumbers.parse(res) |
|
||||
res = phonenumbers.format_number( |
|
||||
res_parse, phonenumbers.PhoneNumberFormat.INTERNATIONAL) |
|
||||
no_break_space = u'\u00A0' |
|
||||
res = res.replace(' ', no_break_space) |
|
||||
except: |
|
||||
pass |
|
||||
# print 'cache value', res |
|
||||
return res |
|
||||
|
|
||||
|
|
||||
class Phone(Fax): |
|
||||
type = 'phone' |
|
@ -1,31 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
# © 2016 SYLEAM |
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
||||
|
|
||||
from .. import common |
|
||||
from odoo import models, api |
|
||||
|
|
||||
|
|
||||
class Base(models.AbstractModel): |
|
||||
_inherit = 'base' |
|
||||
|
|
||||
@api.multi |
|
||||
def write(self, vals): |
|
||||
fields_to_convert = common.get_phone_fields(self, vals) |
|
||||
if fields_to_convert: |
|
||||
for record in self: |
|
||||
loc_vals = common.convert_all_phone_fields( |
|
||||
record, vals, fields_to_convert) |
|
||||
super(Base, record).write(loc_vals) |
|
||||
return True |
|
||||
else: |
|
||||
return super(Base, self).write(vals) |
|
||||
|
|
||||
@api.model |
|
||||
@api.returns('self', lambda value: value.id) |
|
||||
def create(self, vals): |
|
||||
fields_to_convert = common.get_phone_fields(self, vals) |
|
||||
if fields_to_convert: |
|
||||
vals = common.convert_all_phone_fields( |
|
||||
self, vals, fields_to_convert) |
|
||||
return super(Base, self).create(vals) |
|
@ -1,17 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
||||
|
|
||||
from odoo import models, api |
|
||||
|
|
||||
|
|
||||
class IrFieldsConverter(models.AbstractModel): |
|
||||
_inherit = 'ir.fields.converter' |
|
||||
|
|
||||
@api.model |
|
||||
def _str_to_phone(self, model, field, value): |
|
||||
return super(IrFieldsConverter, self)._str_to_char(model, field, value) |
|
||||
|
|
||||
@api.model |
|
||||
def _str_to_fax(self, model, field, value): |
|
||||
return super(IrFieldsConverter, self)._str_to_char(model, field, value) |
|
Before Width: 128 | Height: 128 | Size: 9.2 KiB After Width: 128 | Height: 128 | Size: 9.2 KiB |
@ -1,3 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
|
|
||||
from . import test_phone |
|
@ -1,69 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
# Copyright 2016-2018 Akretion France |
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com> |
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
||||
|
|
||||
|
|
||||
from odoo.tests.common import TransactionCase |
|
||||
|
|
||||
|
|
||||
class TestPhone(TransactionCase): |
|
||||
|
|
||||
def test_phone(self): |
|
||||
company = self.env.ref('base.main_company') |
|
||||
fr_country_id = self.env.ref('base.fr').id |
|
||||
company.country_id = fr_country_id |
|
||||
rpo = self.env['res.partner'] |
|
||||
# Create an existing partner without country |
|
||||
partner1 = rpo.create({ |
|
||||
'name': u'Pierre Paillet', |
|
||||
'phone': '04-72-08-87-32', |
|
||||
'mobile': '06.42.77.42.66', |
|
||||
'fax': '(0) 1 45 42 12 42', |
|
||||
}) |
|
||||
self.assertEquals(partner1.phone, u'+33 4 72 08 87 32') |
|
||||
self.assertEquals(partner1.mobile, u'+33 6 42 77 42 66') |
|
||||
self.assertEquals(partner1.fax, u'+33 1 45 42 12 42') |
|
||||
# Create a partner with country |
|
||||
self.env.ref('base.res_partner_12').country_id =\ |
|
||||
self.env.ref('base.ch').id |
|
||||
partner2 = rpo.create({ |
|
||||
'name': u'Joël Grand-Guillaume', |
|
||||
'parent_id': self.env.ref('base.res_partner_12').id, |
|
||||
'phone': '(0) 21 619 10 10', |
|
||||
'mobile': '(0) 79 606 42 42', |
|
||||
}) |
|
||||
self.assertEquals(partner2.country_id, self.env.ref('base.ch')) |
|
||||
self.assertEquals(partner2.phone, u'+41 21 619 10 10') |
|
||||
self.assertEquals(partner2.mobile, u'+41 79 606 42 42') |
|
||||
# Write on an existing partner |
|
||||
agrolait = self.env.ref('base.res_partner_2') |
|
||||
self.assertEquals(agrolait.country_id, self.env.ref('base.be')) |
|
||||
agrolait.write({'phone': '(0) 2 391 43 74'}) |
|
||||
self.assertEquals(agrolait.phone, u'+32 2 391 43 74') |
|
||||
# Write on an existing partner with country at the same time |
|
||||
agrolait.write({ |
|
||||
'fax': '04 72 89 32 43', |
|
||||
'country_id': fr_country_id, |
|
||||
}) |
|
||||
self.assertEquals(agrolait.fax, u'+33 4 72 89 32 43') |
|
||||
# Write an invalid phone number |
|
||||
partner2.fax = '42' |
|
||||
self.assertEquals(partner2.fax, u'42') |
|
||||
# Test get_name_from_phone_number |
|
||||
pco = self.env['phone.common'] |
|
||||
name = pco.get_name_from_phone_number('0642774266') |
|
||||
self.assertEquals(name, 'Pierre Paillet') |
|
||||
name2 = pco.get_name_from_phone_number('0041216191010') |
|
||||
self.assertEquals(name2, u'Joël Grand-Guillaume (Camptocamp)') |
|
||||
# Test against the POS bug |
|
||||
# https://github.com/OCA/connector-telephony/issues/113 |
|
||||
# When we edit/create a partner from the POS, |
|
||||
# the country_id key in create(vals) is given as a string ! |
|
||||
partnerpos = rpo.create({ |
|
||||
'name': u'POS customer', |
|
||||
'phone': '04-72-08-87-42', |
|
||||
'country_id': str(fr_country_id), |
|
||||
}) |
|
||||
self.assertEquals(partnerpos.phone, u'+33 4 72 08 87 42') |
|
||||
self.assertEquals(partnerpos.country_id.id, fr_country_id) |
|
Before Width: 128 | Height: 128 | Size: 9.2 KiB After Width: 128 | Height: 128 | Size: 9.2 KiB |
Before Width: 128 | Height: 128 | Size: 9.2 KiB After Width: 128 | Height: 128 | Size: 9.2 KiB |
Before Width: 128 | Height: 128 | Size: 9.2 KiB After Width: 128 | Height: 128 | Size: 9.2 KiB |