Browse Source
Merge pull request #44 from akretion/7.0-backport-enhancements-from-8.0
Merge pull request #44 from akretion/7.0-backport-enhancements-from-8.0
7.0: Backport new cool stuff from 8.0 branchpull/57/head
Alexis de Lattre
9 years ago
17 changed files with 335 additions and 274 deletions
-
39asterisk_click2dial_event/asterisk_click2dial_registration.py
-
1base_phone/__openerp__.py
-
192base_phone/base_phone.py
-
3base_phone/res_partner_view.xml
-
110base_phone/static/src/js/phone_widget.js
-
6base_phone/static/src/xml/phone.xml
-
45base_phone/test/phonenum.yml
-
5base_phone/wizard/number_not_found.py
-
40base_phone/wizard/reformat_all_phonenumbers.py
-
10base_phone/wizard/reformat_all_phonenumbers_view.xml
-
19crm_claim_phone/crm_claim_phone.py
-
1crm_phone/__openerp__.py
-
34crm_phone/crm_phone.py
-
41crm_phone/test/phonenum.yml
-
21event_phone/event_phone.py
-
21hr_phone/hr_phone.py
-
21hr_recruitment_phone/hr_recruitment_phone.py
@ -1,39 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk click2dial Registration module for OpenERP |
|||
# Copyright (C) 2013 Invitu <contact@invitu.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as published |
|||
# by the Free Software Foundation, either version 3 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.osv import orm |
|||
|
|||
|
|||
class event_registration(orm.Model): |
|||
_name = 'event.registration' |
|||
_inherit = ['event.registration', 'phone.common'] |
|||
|
|||
def create(self, cr, uid, vals, context=None): |
|||
vals_reformated = self._generic_reformat_phonenumbers( |
|||
cr, uid, vals, context=context) |
|||
return super(event_registration, self).create( |
|||
cr, uid, vals_reformated, context=context) |
|||
|
|||
def write(self, cr, uid, ids, vals, context=None): |
|||
vals_reformated = self._generic_reformat_phonenumbers( |
|||
cr, uid, vals, context=context) |
|||
return super(event_registration, self).write( |
|||
cr, uid, ids, vals_reformated, context=context) |
@ -0,0 +1,45 @@ |
|||
- |
|||
base_phone Write french phone numbers in national format |
|||
- |
|||
!record {model: res.partner, id: partner1}: |
|||
name: Pierre Paillet |
|||
mobile: 06 42 77 42 66 |
|||
fax: (0) 1 45 42 12 42 |
|||
- |
|||
base_phone Write swiss phone numbers in international format |
|||
- |
|||
!record {model: res.partner, id: partner2}: |
|||
name: Joël Grand-Guillaume |
|||
parent_id: base.res_partner_12 |
|||
phone: +41 21 619 10 10 |
|||
mobile: +41 79 606 42 42 |
|||
- |
|||
base_phone Write invalid phone number |
|||
- |
|||
!record {model: res.partner, id: partner3}: |
|||
name: Jean Badphone |
|||
phone: 42 |
|||
- |
|||
base_phone Check that valid phone numbers have been converted to E.164 |
|||
- |
|||
!python {model: res.partner}: | |
|||
partner1 = self.browse(cr, uid, ref('partner1'), context=context) |
|||
assert partner1.mobile == '+33642774266', 'Mobile number not written in E.164 format (partner1)' |
|||
assert partner1.fax == '+33145421242', 'Fax number not written in E.164 format (partner1)' |
|||
partner2 = self.browse(cr, uid, ref('partner2'), context=context) |
|||
assert partner2.phone == '+41216191010', 'Phone number not written in E.164 format (partner2)' |
|||
assert partner2.mobile == '+41796064242', 'Mobile number not written in E.164 format (partner2)' |
|||
- |
|||
base_phone Check that invalid phone numbers are kept unchanged |
|||
- |
|||
!python {model: res.partner}: | |
|||
partner3 = self.browse(cr, uid, ref('partner3'), context=context) |
|||
assert partner3.phone == '42', 'Invalid phone numbers should not be changed' |
|||
- |
|||
base_phone Get name from phone number |
|||
- |
|||
!python {model: phone.common}: | |
|||
name = self.get_name_from_phone_number(cr, uid, '0642774266') |
|||
assert name == 'Pierre Paillet', 'Wrong result for get_name_from_phone_number' |
|||
name2 = self.get_name_from_phone_number(cr, uid, '0041216191010') |
|||
assert name2 == u'Joël Grand-Guillaume (Camptocamp)', 'Wrong result for get_name_from_phone_number (partner2)' |
@ -0,0 +1,41 @@ |
|||
- |
|||
crm_phone Write french phone numbers in national format |
|||
- |
|||
!record {model: crm.lead, id: lead1}: |
|||
name: Jacques Toufaux |
|||
mobile: 06 42 77 42 77 |
|||
fax: (0) 1 45 44 42 43 |
|||
country_id: base.fr |
|||
- |
|||
crm_phone Write swiss phone numbers in national format |
|||
- |
|||
!record {model: crm.lead, id: lead2}: |
|||
name: Michel Content |
|||
country_id: base.ch |
|||
phone: 04 31 23 45 67 |
|||
- |
|||
crm_phone Create a german lead |
|||
- |
|||
!record {model: crm.lead, id: lead3}: |
|||
name: Angela Strasse |
|||
country_id: base.de |
|||
- |
|||
crm_phone Check that valid phone numbers have been converted to E.164 |
|||
- |
|||
!python {model: crm.lead}: | |
|||
lead1 = self.browse(cr, uid, ref('lead1'), context=context) |
|||
assert lead1.mobile == '+33642774277', 'Mobile number not written in E.164 format (lead1)' |
|||
assert lead1.fax == '+33145444243', 'Fax number not written in E.164 format (lead1)' |
|||
lead2 = self.browse(cr, uid, ref('lead2'), context=context) |
|||
assert lead2.phone == '+41431234567', 'Phone number not written in E.164 format (lead2)' |
|||
self.write(cr, uid, ref('lead3'), {'phone': '0891234567'}) |
|||
lead3 = self.browse(cr, uid, ref('lead3'), context=context) |
|||
assert lead3.phone == '+49891234567', 'Phone number not written in E.164 format (lead3)' |
|||
- |
|||
crm_phone Get name from phone number |
|||
- |
|||
!python {model: phone.common}: | |
|||
name = self.get_name_from_phone_number(cr, uid, '0642774277') |
|||
assert name == 'Jacques Toufaux', 'Wrong result for get_name_from_phone_number (lead1)' |
|||
name2 = self.get_name_from_phone_number(cr, uid, '0041431234567') |
|||
assert name2 == 'Michel Content', 'Wrong result for get_name_from_phone_number (lead2)' |
Write
Preview
Loading…
Cancel
Save
Reference in new issue