geolocalisationfeature:forthat,don't use option --server ; only use
--geoloc
"""
__author__="Alexis de Lattre <alexis.delattre@akretion.com>"
@ -69,18 +71,103 @@ from optparse import OptionParser
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 = 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_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_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"}
@ -33,27 +33,62 @@ class wizard_open_calling_partner(osv.osv_memory):
_columns={
# I can't set any field to readonly, because otherwize it would call
# default_get (and thus connect to Asterisk) a second time when the user
# clicks on one of the buttons
'calling_number':fields.char('Calling number',size=30,help="Phone number of calling party that has been obtained from Asterisk."),
'partner_address_id':fields.many2one('res.partner.address','Contact name',help="Partner contact related to the calling number. If there is none and you want to update an existing partner"),
'partner_id':fields.many2one('res.partner','Partner',help="Partner related to the calling number."),
'to_update_partner_address_id':fields.many2one('res.partner.address','Contact to update',help="Partner contact on which the phone or mobile number will be written"),
@ -62,22 +97,38 @@ class wizard_open_calling_partner(osv.osv_memory):
res['partner_address_id']=False
res['to_update_partner_address_id']=False
else:
logger.notifyChannel('click2dial',netsvc.LOG_DEBUG,"Could not get the calling number from Asterisk.")
raiseosv.except_osv(_('Error :'),_("Could not get the calling number from Asterisk. Are you currently on the phone ? If yes, check your setup and look at the OpenERP debug logs."))
logger.notifyChannel(
'click2dial',
netsvc.LOG_DEBUG,
"Could not get the calling number from Asterisk."
)
raiseosv.except_osv(
_('Error :'),
_("Could not get the calling number from Asterisk. "
"Are you currently on the phone ? If yes, check your setup "
raiseosv.except_osv(_('Error :'),_("The object '%s' is not found in your OpenERP database, probably because the related module is not installed."%oerp_object._description))