From 16efdbcc66dbe354b84cf7e27a771e614e2532bf Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 27 Jan 2017 11:59:10 +0100 Subject: [PATCH 1/5] [TEST] Add test from reproduce traceback from website_crm module --- base_phone/test/phonenum.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/base_phone/test/phonenum.yml b/base_phone/test/phonenum.yml index 27aa6d7..ed17b18 100644 --- a/base_phone/test/phonenum.yml +++ b/base_phone/test/phonenum.yml @@ -48,3 +48,11 @@ 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)' +- + Check country_id come from contact us form from website_crm module +- + !python {model: phone.common}: | + vals = self._generic_reformat_phonenumbers(cr, uid, [], { + 'country_id': u'74', 'phone': u'0155667788' + }, context=context) + assert vals['phone'] == '+33155667788' From 5b899340d4237b66dd09155bdc371ed5a7dca61c Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 27 Jan 2017 15:03:03 +0100 Subject: [PATCH 2/5] [FIX] Fix issue with website_crm module --- base_phone/base_phone.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/base_phone/base_phone.py b/base_phone/base_phone.py index afd95d5..1558194 100644 --- a/base_phone/base_phone.py +++ b/base_phone/base_phone.py @@ -53,6 +53,8 @@ class PhoneCommon(models.AbstractModel): user = self.pool['res.users'].browse(cr, uid, uid, context=context) # country_id on res.company is a fields.function that looks at # company_id.partner_id.addres(default).country_id + if isinstance(vals[self._country_field], (str, unicode)): + vals[self._country_field] = int(vals[self._country_field]) countrycode = None if self._country_field: if vals.get(self._country_field): From da158288dce797382ae7775fdc5579e96f761fec Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 27 Jan 2017 15:31:45 +0100 Subject: [PATCH 3/5] [FIX] Fix travis dependencies --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c78953..5dfe813 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,8 @@ install: - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - travis_install_nightly - pip install phonenumbers py-Asterisk SOAPpy - - hg clone http://bitbucket.org/anybox/web_action_request -b ${VERSION} ${HOME}/web_action_request - - hg clone http://bitbucket.org/anybox/bus_enhanced ${HOME}/bus_enhanced + - hg clone http://bitbucket.org/anybox/web_action_request -b ${VERSION} ${HOME}/dependencies/web_action_request + - hg clone http://bitbucket.org/anybox/bus_enhanced ${HOME}/dependencies/bus_enhanced script: - travis_run_tests From 4fdfb6db7f52ebc08903affc341820027073945b Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 27 Jan 2017 15:40:14 +0100 Subject: [PATCH 4/5] [FIX] Check if country_id is passed before check it --- base_phone/base_phone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_phone/base_phone.py b/base_phone/base_phone.py index 1558194..8eae17d 100644 --- a/base_phone/base_phone.py +++ b/base_phone/base_phone.py @@ -53,7 +53,7 @@ class PhoneCommon(models.AbstractModel): user = self.pool['res.users'].browse(cr, uid, uid, context=context) # country_id on res.company is a fields.function that looks at # company_id.partner_id.addres(default).country_id - if isinstance(vals[self._country_field], (str, unicode)): + if self._country_field in vals and isinstance(vals[self._country_field], (str, unicode)): vals[self._country_field] = int(vals[self._country_field]) countrycode = None if self._country_field: From cc1b82549601e0712a6e1769051980209b994a55 Mon Sep 17 00:00:00 2001 From: Christophe CHAUVET Date: Fri, 27 Jan 2017 15:52:54 +0100 Subject: [PATCH 5/5] [FIX] Use res.partner instead of phone.common --- base_phone/test/phonenum.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_phone/test/phonenum.yml b/base_phone/test/phonenum.yml index ed17b18..08c7365 100644 --- a/base_phone/test/phonenum.yml +++ b/base_phone/test/phonenum.yml @@ -51,7 +51,7 @@ - Check country_id come from contact us form from website_crm module - - !python {model: phone.common}: | + !python {model: res.partner}: | vals = self._generic_reformat_phonenumbers(cr, uid, [], { 'country_id': u'74', 'phone': u'0155667788' }, context=context)