Add support for geolocalisation via the phonenumbers lib in the get_cid_name.py script. If you add --geoloc, the numbers that are not found in OpenERP will be geolocalized.
Thanks to Ludovic Gasc for making me discover this great "phonenumbers" lib.
feature:forthat,don't use option --server ; only use --geoloc
"""
__author__="Alexis de Lattre <alexis.delattre@akretion.com>"
__date__="December 2010"
__version__="0.1"
__version__="0.2"
# Copyright (C) 2010-2012 Alexis de Lattre <alexis.delattre@akretion.com>
#
@ -61,18 +65,23 @@ from optparse import OptionParser
# CID Name that will be displayed if there is no match in res.partner.address
# and no geolocalisation
default_cid_name="Not in OpenERP"
# Define command line options
option_server={'names':('-s','--server'),'dest':'server','type':'string','help':'DNS or IP address of the OpenERP server. Default = localhost','action':'store','default':'localhost'}
option_server={'names':('-s','--server'),'dest':'server','type':'string','help':'DNS or IP address of the OpenERP server. Default = none (will not try to connect to OpenERP)','action':'store','default':False}
option_port={'names':('-p','--port'),'dest':'port','type':'int','help':"Port of OpenERP's XML-RPC interface. Default = 8069",'action':'store','default':8069}
option_ssl={'names':('-e','--ssl'),'dest':'ssl','help':"Use XML-RPC secure i.e. with SSL instead of clear XML-RPC. Default = no, use clear XML-RPC.",'action':'store_true','default':False}
option_ssl={'names':('-e','--ssl'),'dest':'ssl','help':"Use XML-RPC secure i.e. with SSL instead of clear XML-RPC. Default = no, use clear XML-RPC",'action':'store_true','default':False}
option_user={'names':('-u','--user-id'),'dest':'user','type':'int','help':"OpenERP user ID to use when connecting to OpenERP. Default = 2",'action':'store','default':2}
option_password={'names':('-w','--password'),'dest':'password','type':'string','help':"Password of the OpenERP user. Default = demo",'action':'store','default':'demo'}
option_password={'names':('-w','--password'),'dest':'password','type':'string','help':"Password of the OpenERP user. Default = 'demo'",'action':'store','default':'demo'}
option_ascii={'names':('-a','--ascii'),'dest':'ascii','help':"Convert name from UTF-8 to ASCII. Default = no, keep UTF-8",'action':'store_true','default':False}
option_geoloc={'names':('-g','--geoloc'),'dest':'geoloc','help':"Try to geolocate phone numbers unknown to OpenERP. This features requires the 'phonenumbers' Python lib. To install it, run 'sudo pip install phonenumbers' Default = no",'action':'store_true','default':False}
option_geoloc_lang={'names':('-l','--geoloc-lang'),'dest':'lang','help':"Language in which the name of the country and city name will be displayed by the geolocalisation database. Use the 2 letters ISO code of the language. Default = 'en'",'action':'store','default':"en"}
option_geoloc_country={'names':('-c','--geoloc-country'),'dest':'country','help':"2 letters ISO code for your country e.g. 'FR' for France. This will be used by the geolocalisation system to parse the phone number of the calling party. Default = 'FR'",'action':'store','default':"FR"}
option_geoloc_cityonly={'names':('-t','--geoloc-city-only'),'dest':'cityonly','help':"Only display the city name, instead of displaying both the country and the city. Default = no",'action':'store_true','default':False}