Browse Source

Feature "Open Calling Partner" replaced by "Open Caller", with a completely new behavior

As a consequence, the modules asterisk_click2dial_event and asterisk_click2dial_crm_claim have been dropped
New wizard "Number not found" (inspired by the old "Open Calling Partner" with many enhancements), which is called by base_phone_popup and Open Caller
Formatting of number for click2dial is now handled by the phonenumbers lib: as a consequence, 3 fields have been dropped from asterisk.server (national_prefix, international_prefix, country_prefix)
New option 'dial_button_invisible' in the phone widget
New sample script asterisk_click2dial/scripts/openerp_popup_timeout.sh
Update translations and some module descriptions
All the modules are now PEP8 compliant
pull/7/head
Alexis de Lattre 10 years ago
parent
commit
232fefac79
  1. 2
      asterisk_click2dial/__init__.py
  2. 60
      asterisk_click2dial/__openerp__.py
  3. 476
      asterisk_click2dial/asterisk_click2dial.py
  4. 1
      asterisk_click2dial/asterisk_click2dial_demo.xml
  5. 4
      asterisk_click2dial/asterisk_server_view.xml
  6. 18
      asterisk_click2dial/controller.py
  7. 367
      asterisk_click2dial/i18n/asterisk_click2dial.pot
  8. 413
      asterisk_click2dial/i18n/fr.po
  9. 27
      asterisk_click2dial/scripts/openerp_popup_timeout.sh
  10. 77
      asterisk_click2dial/scripts/set_name_agi.py
  11. 4
      asterisk_click2dial/static/src/css/asterisk_click2dial.css
  12. 58
      asterisk_click2dial/static/src/js/asterisk_click2dial.js
  13. 8
      asterisk_click2dial/static/src/xml/asterisk_click2dial.xml
  14. 22
      asterisk_click2dial/wizard/__init__.py
  15. 223
      asterisk_click2dial/wizard/open_calling_partner.py
  16. 51
      asterisk_click2dial/wizard/open_calling_partner_view.xml
  17. 1
      asterisk_click2dial_crm/__openerp__.py
  18. 11
      asterisk_click2dial_crm/asterisk_click2dial_crm.py
  19. 7
      asterisk_click2dial_crm/i18n/asterisk_click2dial_crm.pot
  20. 7
      asterisk_click2dial_crm/i18n/fr.po
  21. 12
      asterisk_click2dial_crm/wizard/create_crm_phonecall.py
  22. 24
      asterisk_click2dial_crm/wizard/open_calling_partner_view.xml
  23. 46
      asterisk_click2dial_crm_claim/__openerp__.py
  24. 23
      asterisk_click2dial_crm_claim/wizard/__init__.py
  25. 32
      asterisk_click2dial_crm_claim/wizard/open_calling_partner.py
  26. 24
      asterisk_click2dial_crm_claim/wizard/open_calling_partner_view.xml
  27. 43
      asterisk_click2dial_event/__openerp__.py
  28. 22
      asterisk_click2dial_event/wizard/__init__.py
  29. 31
      asterisk_click2dial_event/wizard/open_calling_partner.py
  30. 23
      asterisk_click2dial_event/wizard/open_calling_partner_view.xml
  31. 1
      base_phone/__openerp__.py
  32. 7
      base_phone/base_phone.py
  33. 115
      base_phone/i18n/base_phone.pot
  34. 121
      base_phone/i18n/fr.po
  35. 88
      base_phone/static/src/js/phone_widget.js
  36. 1
      base_phone/wizard/__init__.py
  37. 130
      base_phone/wizard/number_not_found.py
  38. 55
      base_phone/wizard/number_not_found_view.xml
  39. 25
      base_phone_popup/i18n/base_phone_popup.pot
  40. 32
      base_phone_popup/i18n/fr.po
  41. 11
      base_phone_popup/popup.py
  42. 1
      crm_phone/__init__.py
  43. 1
      crm_phone/__openerp__.py
  44. 112
      crm_phone/i18n/crm_phone.pot
  45. 112
      crm_phone/i18n/fr.po
  46. 6
      crm_phone/wizard/__init__.py
  47. 105
      crm_phone/wizard/number_not_found.py
  48. 36
      crm_phone/wizard/number_not_found_view.xml

2
asterisk_click2dial/__init__.py

@ -20,4 +20,4 @@
##############################################################################
from . import asterisk_click2dial
from . import wizard
from . import controller

60
asterisk_click2dial/__openerp__.py

@ -26,30 +26,49 @@
'category': 'Phone',
'license': 'AGPL-3',
'summary': 'Asterisk-OpenERP connector',
'description': """This module adds 3 functionalities :
'description': """
Asterisk-OpenERP connector
==========================
1) It adds a 'dial' button in the partner form view so that users can directly dial a phone number through Asterisk. This feature is usually known as 'click2dial'. Here is how it works :
. In OpenERP, the user clicks on the 'dial' button next to a phone number field in the partner view.
. OpenERP connects to the Asterisk Manager Interface and Asterisk makes the user's phone ring.
. The user answers his own phone (if he doesn't, the process stops here).
. Asterisk dials the phone number found in OpenERP in place of the user.
. If the remote party answers, the user can talk to his correspondent.
The technical name of this module is *asterisk_click2dial*, but this module implements much more than a simple *click2dial* ! This module adds 3 functionalities:
1) It adds a *Dial* button in the partner form view so that users can directly dial a phone number through Asterisk. This feature is usually known as *click2dial*. Here is how it works :
* In OpenERP, the user clicks on the *Dial* button next to a phone number field in the partner view.
* OpenERP connects to the Asterisk Manager Interface and Asterisk makes the user's phone ring.
* The user answers his own phone (if he doesn't, the process stops here).
* Asterisk dials the phone number found in OpenERP in place of the user.
* If the remote party answers, the user can talk to his correspondent.
2) It adds the ability to show the name of the calling party on the screen of your IP phone on incoming phone calls if the presented
phone number is present in the partner/leads/employees/... of OpenERP. Here is how it works :
. On incoming phone calls, the Asterisk dialplan executes an AGI script "set_name_incoming_timeout.sh".
. The "set_name_incoming_timeout.sh" script calls the "set_name_agi.py" script with a short timeout.
. The "set_name_agi.py" script will make an XML-RPC request on the OpenERP server to try to find the name of the person corresponding to the phone number presented by the calling party.
. If it finds the name, it is set as the CallerID name of the call, so as to be presented on the IP phone of the user.
It also works on outgoing calls, so as to display the name of the callee on the SIP phone of the caller. For that, you should use the script "set_name_outgoing_timeout.sh".
3) It adds a button "Open calling partner" in the menu "Sales > Address book" to get the partner corresponding to the calling party in one click. Here is how it works :
. When the user clicks on the "Open calling partner" button, OpenERP sends a query to the Asterisk Manager Interface to get a list of the current phone calls
. If it finds a phone call involving the user's phone, it gets the phone number of the calling party
. It searches the phone number of the calling party in the Partners of OpenERP. If a record matches, it shows the name of the related Partner and proposes to open it, or open its related sale orders or invoices. If no record matches, it proposes to create a new Contact with the presented phone number as 'Phone' or 'Mobile' number or update an existing Contact.
It is possible to get a pop-up of the partner corresponding to the calling party without any action from the user via the module *asterisk_popup*.
A detailed documentation for this module is available on the Akretion Web site : http://www.akretion.com/en/products-and-services/openerp-asterisk-voip-connector """,
* On incoming phone calls, the Asterisk dialplan executes an AGI script "set_name_incoming_timeout.sh".
* The "set_name_incoming_timeout.sh" script calls the "set_name_agi.py" script with a short timeout.
* The "set_name_agi.py" script will make an XML-RPC request on the OpenERP server to try to find the name of the person corresponding to the phone number presented by the calling party.
* If it finds the name, it is set as the CallerID name of the call, so as to be presented on the IP phone of the user.
It also works on outgoing calls, so as to display the name of the callee on the SIP phone of the caller. For that, you should use the script "set_name_outgoing_timeout.sh".
3) It adds a phone icon (*Open Caller*) in the top menu bar (next to the Preferences) to get the partner/lead/candidate/registrations corresponding to the calling party in one click. Here is how it works :
* When the user clicks on the phone icon, OpenERP sends a query to the Asterisk Manager Interface to get a list of the current phone calls
* If it finds a phone call involving the user's phone, it gets the phone number of the calling party
* It searches the phone number of the calling party in the Partners/Leads/Candidates/Registrations of OpenERP. If a record matches, it takes you to the form view of this record. If no record matchs, it opens a wizard which proposes to create a new Partner with the presented phone number as *Phone* or *Mobile* number or update an existing Partner.
It is possible to get a pop-up of the record corresponding to the calling party without any action from the user via the module *base_phone_popup*.
A detailed documentation for this module is available on the Akretion Web site : http://www.akretion.com/en/products-and-services/openerp-asterisk-voip-connector
""",
'author': 'Akretion',
'website': 'http://www.akretion.com/',
'depends': ['base_phone'],
@ -57,7 +76,6 @@ A detailed documentation for this module is available on the Akretion Web site :
'data': [
'asterisk_server_view.xml',
'res_users_view.xml',
'wizard/open_calling_partner_view.xml',
'security/ir.model.access.csv',
],
'demo': ['asterisk_click2dial_demo.xml'],

476
asterisk_click2dial/asterisk_click2dial.py

@ -25,88 +25,127 @@ import logging
# Lib for phone number reformating -> pip install phonenumbers
import phonenumbers
# Lib py-asterisk from http://code.google.com/p/py-asterisk/
# We need a version which has this commit : http://code.google.com/p/py-asterisk/source/detail?r=8d0e1c941cce727c702582f3c9fcd49beb4eeaa4
# so a version after Nov 20th, 2012
# -> pip install py-Asterisk
from Asterisk import Manager
_logger = logging.getLogger(__name__)
class asterisk_server(orm.Model):
'''Asterisk server object, to store all the parameters of the Asterisk IPBXs'''
'''Asterisk server object, stores the parameters of the Asterisk IPBXs'''
_name = "asterisk.server"
_description = "Asterisk Servers"
_columns = {
'name': fields.char('Asterisk server name', size=50, required=True, help="Asterisk server name."),
'active': fields.boolean('Active', help="The active field allows you to hide the Asterisk server without deleting it."),
'ip_address': fields.char('Asterisk IP addr. or DNS', size=50, required=True, help="IP address or DNS name of the Asterisk server."),
'port': fields.integer('Port', required=True, help="TCP port on which the Asterisk Manager Interface listens. Defined in /etc/asterisk/manager.conf on Asterisk."),
'out_prefix': fields.char('Out prefix', size=4, help="Prefix to dial to place outgoing calls. If you don't use a prefix to place outgoing calls, leave empty."),
'national_prefix': fields.char('National prefix', size=4, help="Prefix for national phone calls (don't include the 'out prefix'). For e.g., in France, the phone numbers look like '01 41 98 12 42' : the National prefix is '0'."),
'international_prefix': fields.char('International prefix', required=True, size=4, help="Prefix to add to make international phone calls (don't include the 'out prefix'). For e.g., in France, the International prefix is '00'."),
'country_prefix': fields.char('My country prefix', required=True, size=4, help="Phone prefix of the country where the Asterisk server is located. For e.g. the phone prefix for France is '33'. If the phone number to dial starts with the 'My country prefix', OpenERP will remove the country prefix from the phone number and add the 'out prefix' followed by the 'national prefix'. If the phone number to dial doesn't start with the 'My country prefix', OpenERP will add the 'out prefix' followed by the 'international prefix'."),
'login': fields.char('AMI login', size=30, required=True, help="Login that OpenERP will use to communicate with the Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf on your Asterisk server."),
'password': fields.char('AMI password', size=30, required=True, help="Password that OpenERP will use to communicate with the Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf on your Asterisk server."),
'context': fields.char('Dialplan context', size=50, required=True, help="Asterisk dialplan context from which the calls will be made. Refer to /etc/asterisk/extensions.conf on your Asterisk server."),
'wait_time': fields.integer('Wait time (sec)', required=True, help="Amount of time (in seconds) Asterisk will try to reach the user's phone before hanging up."),
'extension_priority': fields.integer('Extension priority', required=True, help="Priority of the extension in the Asterisk dialplan. Refer to /etc/asterisk/extensions.conf on your Asterisk server."),
'alert_info': fields.char('Alert-Info SIP header', size=255, help="Set Alert-Info header in SIP request to user's IP Phone for the click2dial feature. If empty, the Alert-Info header will not be added. You can use it to have a special ring tone for click2dial (a silent one !) or to activate auto-answer for example."),
'company_id': fields.many2one('res.company', 'Company', help="Company who uses the Asterisk server."),
'name': fields.char('Asterisk Server Name', size=50, required=True),
'active': fields.boolean(
'Active', help="The active field allows you to hide the Asterisk "
"server without deleting it."),
'ip_address': fields.char(
'Asterisk IP address or DNS', size=50, required=True,
help="IP address or DNS name of the Asterisk server."),
'port': fields.integer(
'Port', required=True,
help="TCP port on which the Asterisk Manager Interface listens. "
"Defined in /etc/asterisk/manager.conf on Asterisk."),
'out_prefix': fields.char(
'Out Prefix', size=4, help="Prefix to dial to make outgoing "
"calls. If you don't use a prefix to make outgoing calls, "
"leave empty."),
'login': fields.char(
'AMI Login', size=30, required=True,
help="Login that OpenERP will use to communicate with the "
"Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf "
"on your Asterisk server."),
'password': fields.char(
'AMI Password', size=30, required=True,
help="Password that OpenERP will use to communicate with the "
"Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf "
"on your Asterisk server."),
'context': fields.char(
'Dialplan Context', size=50, required=True,
help="Asterisk dialplan context from which the calls will be "
"made. Refer to /etc/asterisk/extensions.conf on your Asterisk "
"server."),
'wait_time': fields.integer(
'Wait Time (sec)', required=True,
help="Amount of time (in seconds) Asterisk will try to reach "
"the user's phone before hanging up."),
'extension_priority': fields.integer(
'Extension Priority', required=True,
help="Priority of the extension in the Asterisk dialplan. Refer "
"to /etc/asterisk/extensions.conf on your Asterisk server."),
'alert_info': fields.char(
'Alert-Info SIP Header', size=255,
help="Set Alert-Info header in SIP request to user's IP Phone "
"for the click2dial feature. If empty, the Alert-Info header "
"will not be added. You can use it to have a special ring tone "
"for click2dial (a silent one !) or to activate auto-answer "
"for example."),
'company_id': fields.many2one(
'res.company', 'Company',
help="Company who uses the Asterisk server."),
}
def _get_prefix_from_country(self, cr, uid, context=None):
user = self.pool['res.users'].browse(cr, uid, uid, context=context)
country_code = user.company_id and user.company_id.partner_id and user.company_id.partner_id.country_id and user.company_id.partner_id.country_id.code or False
default_country_prefix = False
if country_code:
default_country_prefix = phonenumbers.country_code_for_region(country_code)
return default_country_prefix
_defaults = {
'active': True,
'port': 5038, # Default AMI port
'national_prefix': '0',
'international_prefix': '00',
'country_prefix': _get_prefix_from_country,
'extension_priority': 1,
'wait_time': 15,
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'asterisk.server', context=context),
'company_id': lambda self, cr, uid, context:
self.pool['res.company']._company_default_get(
cr, uid, 'asterisk.server', context=context),
}
def _check_validity(self, cr, uid, ids):
for server in self.browse(cr, uid, ids):
country_prefix = ('Country prefix', server.country_prefix)
international_prefix = ('International prefix', server.international_prefix)
out_prefix = ('Out prefix', server.out_prefix)
national_prefix = ('National prefix', server.national_prefix)
dialplan_context = ('Dialplan context', server.context)
alert_info = ('Alert-Info SIP header', server.alert_info)
login = ('AMI login', server.login)
password = ('AMI password', server.password)
for digit_prefix in [country_prefix, international_prefix, out_prefix, national_prefix]:
if digit_prefix[1] and not digit_prefix[1].isdigit():
raise orm.except_orm(_('Error :'), _("Only use digits for the '%s' on the Asterisk server '%s'" % (digit_prefix[0], server.name)))
if out_prefix[1] and not out_prefix[1].isdigit():
raise orm.except_orm(
_('Error:'),
_("Only use digits for the '%s' on the Asterisk server "
"'%s'" % (out_prefix[0], server.name)))
if server.wait_time < 1 or server.wait_time > 120:
raise orm.except_orm(_('Error :'), _("You should set a 'Wait time' value between 1 and 120 seconds for the Asterisk server '%s'" % server.name))
raise orm.except_orm(
_('Error:'),
_("You should set a 'Wait time' value between 1 and 120 "
"seconds for the Asterisk server '%s'" % server.name))
if server.extension_priority < 1:
raise orm.except_orm(_('Error :'), _("The 'extension priority' must be a positive value for the Asterisk server '%s'" % server.name))
raise orm.except_orm(
_('Error:'),
_("The 'extension priority' must be a positive value for "
"the Asterisk server '%s'" % server.name))
if server.port > 65535 or server.port < 1:
raise orm.except_orm(_('Error :'), _("You should set a TCP port between 1 and 65535 for the Asterisk server '%s'" % server.name))
for check_string in [dialplan_context, alert_info, login, password]:
if check_string[1]:
raise orm.except_orm(
_('Error:'),
_("You should set a TCP port between 1 and 65535 for the "
"Asterisk server '%s'" % server.name))
for check_str in [dialplan_context, alert_info, login, password]:
if check_str[1]:
try:
string = check_string[1].encode('ascii')
check_str[1].encode('ascii')
except UnicodeEncodeError:
raise orm.except_orm(_('Error :'), _("The '%s' should only have ASCII caracters for the Asterisk server '%s'" % (check_string[0], server.name)))
raise orm.except_orm(
_('Error:'),
_("The '%s' should only have ASCII caracters for "
"the Asterisk server '%s'"
% (check_str[0], server.name)))
return True
_constraints = [(
_check_validity,
"Error message in raise",
[
'out_prefix', 'wait_time', 'extension_priority', 'port',
'context', 'alert_info', 'login', 'password']
)]
_constraints = [
(_check_validity, "Error message in raise", ['out_prefix', 'country_prefix', 'national_prefix', 'international_prefix', 'wait_time', 'extension_priority', 'port', 'context', 'alert_info', 'login', 'password']),
]
def _reformat_number(self, cr, uid, erp_number, ast_server, context=None):
def _reformat_number(
self, cr, uid, erp_number, ast_server=None, context=None):
'''
This function is dedicated to the transformation of the number
available in OpenERP to the number that Asterisk should dial.
@ -114,76 +153,26 @@ class asterisk_server(orm.Model):
for your company if you are not happy with the way I reformat
the OpenERP numbers.
'''
error_title_msg = _("Invalid phone number")
invalid_international_format_msg = _("The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42")
invalid_national_format_msg = _("The phone number is not written in valid national format.")
invalid_format_msg = _("The phone number is not written in valid format.")
# Let's call the variable tmp_number now
tmp_number = erp_number
_logger.debug('Number before reformat = %s' % tmp_number)
# Check if empty
if not tmp_number:
raise orm.except_orm(error_title_msg, invalid_format_msg)
# Before starting to use prefix, we convert empty prefix whose value
# is False to an empty string
country_prefix = ast_server.country_prefix or ''
national_prefix = ast_server.national_prefix or ''
international_prefix = ast_server.international_prefix or ''
out_prefix = ast_server.out_prefix or ''
# Maybe one day we will use
# phonenumbers.format_out_of_country_calling_number(phonenumbers.parse('<phone_number_e164', None), 'FR')
# The country code seems to be OK with the ones of OpenERP
# But it returns sometimes numbers with '-'... we have to investigate this first
# International format
if tmp_number[0] != '+':
raise # This should never happen
# Remove the starting '+' of the number
tmp_number = tmp_number.replace('+','')
_logger.debug('Number after removal of special char = %s' % tmp_number)
# At this stage, 'tmp_number' should only contain digits
if not tmp_number.isdigit():
raise orm.except_orm(error_title_msg, invalid_format_msg)
_logger.debug('Country prefix = %s' % country_prefix)
if country_prefix == tmp_number[0:len(country_prefix)]:
# If the number is a national number,
# remove 'my country prefix' and add 'national prefix'
tmp_number = (national_prefix) + tmp_number[len(country_prefix):len(tmp_number)]
_logger.debug('National prefix = %s - Number with national prefix = %s' % (national_prefix, tmp_number))
else:
# If the number is an international number,
# add 'international prefix'
tmp_number = international_prefix + tmp_number
_logger.debug('International prefix = %s - Number with international prefix = %s' % (international_prefix, tmp_number))
assert(erp_number), 'Missing phone number'
_logger.debug('Number before reformat = %s' % erp_number)
if not ast_server:
ast_server = self._get_asterisk_server_from_user(
cr, uid, context=context)
# erp_number are supposed to be in E.164 format, so no need to
# give a country code here
parsed_num = phonenumbers.parse(erp_number, None)
country_code = ast_server.company_id.country_id.code
assert(country_code), 'Missing country on company'
_logger.debug('Country code = %s' % country_code)
to_dial_number = phonenumbers.format_out_of_country_calling_number(
parsed_num, country_code.upper()).replace(' ', '')
# Add 'out prefix' to all numbers
tmp_number = out_prefix + tmp_number
_logger.debug('Out prefix = %s - Number to be sent to Asterisk = %s' % (out_prefix, tmp_number))
return tmp_number
# TODO : one day, we will use phonenumbers.format_out_of_country_calling_number() ?
# if yes, then we can trash the fields international_prefix, national_prefix
# country_prefix and this kind of code
def _convert_number_to_international_format(self, cr, uid, number, ast_server, context=None):
'''Convert the number presented by the phone network to a number
in international format e.g. +33141981242'''
if number and number.isdigit() and len(number) > 5:
if ast_server.international_prefix and number[0:len(ast_server.international_prefix)] == ast_server.international_prefix:
number = number[len(ast_server.international_prefix):]
number = '+' + number
elif ast_server.national_prefix and number[0:len(ast_server.national_prefix)] == ast_server.national_prefix:
number = number[len(ast_server.national_prefix):]
number = '+' + ast_server.country_prefix + number
return number
if ast_server.out_prefix:
_logger.debug('Out prefix = %s' % ast_server.out_prefix)
to_dial_number = '%s%s' % (ast_server.out_prefix, to_dial_number)
_logger.debug('Number to be sent to Asterisk = %s' % to_dial_number)
return to_dial_number
def _get_asterisk_server_from_user(self, cr, uid, context=None):
'''Returns an asterisk.server browse object'''
@ -192,12 +181,19 @@ class asterisk_server(orm.Model):
if user.asterisk_server_id.id:
ast_server = user.asterisk_server_id
else:
asterisk_server_ids = self.search(cr, uid, [('company_id', '=', user.company_id.id)], context=context)
# If no asterisk server is configured on the user, we take the first one
asterisk_server_ids = self.search(
cr, uid, [('company_id', '=', user.company_id.id)],
context=context)
# If the user doesn't have an asterisk server,
# we take the first one of the user's company
if not asterisk_server_ids:
raise orm.except_orm(_('Error :'), _("No Asterisk server configured for the company '%s'.") % user.company_id.name)
raise orm.except_orm(
_('Error:'),
_("No Asterisk server configured for the company '%s'.")
% user.company_id.name)
else:
ast_server = self.browse(cr, uid, asterisk_server_ids[0], context=context)
ast_server = self.browse(
cr, uid, asterisk_server_ids[0], context=context)
return ast_server
def _connect_to_asterisk(self, cr, uid, context=None):
@ -208,29 +204,40 @@ class asterisk_server(orm.Model):
'''
user = self.pool['res.users'].browse(cr, uid, uid, context=context)
# Note : if I write 'Error' without ' :', it won't get translated...
# I don't understand why !
ast_server = self._get_asterisk_server_from_user(cr, uid, context=context)
ast_server = self._get_asterisk_server_from_user(
cr, uid, context=context)
# We check if the current user has a chan type
if not user.asterisk_chan_type:
raise orm.except_orm(_('Error :'), _('No channel type configured for the current user.'))
raise orm.except_orm(
_('Error:'),
_('No channel type configured for the current user.'))
# We check if the current user has an internal number
if not user.resource:
raise orm.except_orm(_('Error :'), _('No resource name configured for the current user'))
raise orm.except_orm(
_('Error:'),
_('No resource name configured for the current user'))
_logger.debug("User's phone : %s/%s" % (user.asterisk_chan_type, user.resource))
_logger.debug("Asterisk server = %s:%d" % (ast_server.ip_address, ast_server.port))
_logger.debug(
"User's phone: %s/%s" % (user.asterisk_chan_type, user.resource))
_logger.debug(
"Asterisk server: %s:%d"
% (ast_server.ip_address, ast_server.port))
# Connect to the Asterisk Manager Interface
try:
ast_manager = Manager.Manager((ast_server.ip_address, ast_server.port), ast_server.login, ast_server.password)
ast_manager = Manager.Manager(
(ast_server.ip_address, ast_server.port),
ast_server.login, ast_server.password)
except Exception, e:
_logger.error("Error in the request to the Asterisk Manager Interface %s" % ast_server.ip_address)
_logger.error(
"Error in the request to the Asterisk Manager Interface %s"
% ast_server.ip_address)
_logger.error("Here is the error message: %s" % e)
raise orm.except_orm(_('Error :'), _("Problem in the request from OpenERP to Asterisk. Here is the error message: %s" % e))
raise orm.except_orm(
_('Error:'),
_("Problem in the request from OpenERP to Asterisk. "
"Here is the error message: %s" % e))
return False
return (user, ast_server, ast_manager)
@ -260,57 +267,90 @@ class asterisk_server(orm.Model):
def _get_calling_number(self, cr, uid, context=None):
user, ast_server, ast_manager = self._connect_to_asterisk(cr, uid, context=context)
user, ast_server, ast_manager = self._connect_to_asterisk(
cr, uid, context=context)
calling_party_number = False
try:
list_chan = ast_manager.Status()
#from pprint import pprint
#pprint(list_chan)
# from pprint import pprint
# pprint(list_chan)
_logger.debug("Result of Status AMI request: %s", list_chan)
for chan in list_chan.values():
sip_account = user.asterisk_chan_type + '/' + user.resource
if chan.get('ChannelState') == '4' and chan.get('ConnectedLineNum') == user.internal_number: # 4 = Ring
# 4 = Ring
if (
chan.get('ChannelState') == '4' and
chan.get('ConnectedLineNum') == user.internal_number):
_logger.debug("Found a matching Event in 'Ring' state")
calling_party_number = chan.get('CallerIDNum')
break
if chan.get('ChannelState') == '6' and sip_account in chan.get('BridgedChannel', ''): # 6 = Up
# 6 = Up
if (
chan.get('ChannelState') == '6'
and sip_account in chan.get('BridgedChannel', '')):
_logger.debug("Found a matching Event in 'Up' state")
calling_party_number = chan.get('CallerIDNum')
break
# Compatibility with Asterisk 1.4
if chan.get('State') == 'Up' and sip_account in chan.get('Link', ''):
if (
chan.get('State') == 'Up'
and sip_account in chan.get('Link', '')):
_logger.debug("Found a matching Event in 'Up' state")
calling_party_number = chan.get('CallerIDNum')
break
except Exception, e:
_logger.error("Error in the Status request to Asterisk server %s" % ast_server.ip_address)
_logger.error("Here is the detail of the error : '%s'" % unicode(e))
raise orm.except_orm(_('Error :'), _("Can't get calling number from Asterisk.\nHere is the error: '%s'" % unicode(e)))
_logger.error(
"Error in the Status request to Asterisk server %s"
% ast_server.ip_address)
_logger.error(
"Here are the details of the error: '%s'" % unicode(e))
raise orm.except_orm(
_('Error:'),
_("Can't get calling number from Asterisk.\nHere is the "
"error: '%s'" % unicode(e)))
finally:
ast_manager.Logoff()
_logger.debug("The calling party number is '%s'" % calling_party_number)
_logger.debug("Calling party number: '%s'" % calling_party_number)
return calling_party_number
def get_record_from_my_channel(self, cr, uid, context=None):
calling_number = self.pool['asterisk.server']._get_calling_number(
cr, uid, context=context)
# calling_number = "0641981246"
if calling_number:
record = self.pool['phone.common'].get_record_from_phone_number(
cr, uid, calling_number, context=context)
if record:
return record
else:
return calling_number
else:
return False
# Parameters specific for each user
class res_users(orm.Model):
_inherit = "res.users"
_columns = {
'internal_number': fields.char('Internal number', size=15,
'internal_number': fields.char(
'Internal Number', size=15,
help="User's internal phone number."),
'dial_suffix': fields.char('User-specific dial suffix', size=15,
help="User-specific dial suffix such as aa=2wb for SCCP auto answer."),
'callerid': fields.char('Caller ID', size=50,
'dial_suffix': fields.char(
'User-specific Dial Suffix', size=15,
help="User-specific dial suffix such as aa=2wb for SCCP "
"auto answer."),
'callerid': fields.char(
'Caller ID', size=50,
help="Caller ID used for the calls initiated by this user."),
# You'd probably think : Asterisk should reuse the callerID of sip.conf !
# But it cannot, cf http://lists.digium.com/pipermail/asterisk-users/2012-January/269787.html
'cdraccount': fields.char('CDR Account', size=50,
help="Call Detail Record (CDR) account used for billing this user."),
# You'd probably think: Asterisk should reuse the callerID of sip.conf!
# But it cannot, cf
# http://lists.digium.com/pipermail/asterisk-users/2012-January/269787.html
'cdraccount': fields.char(
'CDR Account', size=50,
help="Call Detail Record (CDR) account used for billing this "
"user."),
'asterisk_chan_type': fields.selection([
('SIP', 'SIP'),
('IAX2', 'IAX2'),
@ -322,15 +362,35 @@ class res_users(orm.Model):
('H323', 'H323'),
('SCCP', 'SCCP'),
('Local', 'Local'),
], 'Asterisk channel type',
help="Asterisk channel type, as used in the Asterisk dialplan. If the user has a regular IP phone, the channel type is 'SIP'."),
'resource': fields.char('Resource name', size=64,
help="Resource name for the channel type selected. For example, if you use 'Dial(SIP/phone1)' in your Asterisk dialplan to ring the SIP phone of this user, then the resource name for this user is 'phone1'. For a SIP phone, the phone number is often used as resource name, but not always."),
'alert_info': fields.char('User-specific Alert-Info SIP header', size=255, help="Set a user-specific Alert-Info header in SIP request to user's IP Phone for the click2dial feature. If empty, the Alert-Info header will not be added. You can use it to have a special ring tone for click2dial (a silent one !) or to activate auto-answer for example."),
'variable': fields.char('User-specific Variable', size=255, help="Set a user-specific 'Variable' field in the Asterisk Manager Interface 'originate' request for the click2dial feature. If you want to have several variable headers, separate them with '|'."),
'asterisk_server_id': fields.many2one('asterisk.server', 'Asterisk server',
help="Asterisk server on which the user's phone is connected. If you leave this field empty, it will use the first Asterisk server of the user's company."),
}
], 'Asterisk Channel Type',
help="Asterisk channel type, as used in the Asterisk dialplan. "
"If the user has a regular IP phone, the channel type is 'SIP'."),
'resource': fields.char(
'Resource Name', size=64,
help="Resource name for the channel type selected. For example, "
"if you use 'Dial(SIP/phone1)' in your Asterisk dialplan to ring "
"the SIP phone of this user, then the resource name for this user "
"is 'phone1'. For a SIP phone, the phone number is often used as "
"resource name, but not always."),
'alert_info': fields.char(
'User-specific Alert-Info SIP Header', size=255,
help="Set a user-specific Alert-Info header in SIP request to "
"user's IP Phone for the click2dial feature. If empty, the "
"Alert-Info header will not be added. You can use it to have a "
"special ring tone for click2dial (a silent one !) or to "
"activate auto-answer for example."),
'variable': fields.char(
'User-specific Variable', size=255,
help="Set a user-specific 'Variable' field in the Asterisk "
"Manager Interface 'originate' request for the click2dial "
"feature. If you want to have several variable headers, separate "
"them with '|'."),
'asterisk_server_id': fields.many2one(
'asterisk.server', 'Asterisk Server',
help="Asterisk server on which the user's phone is connected. "
"If you leave this field empty, it will use the first Asterisk "
"server of the user's company."),
}
_defaults = {
'asterisk_chan_type': 'SIP',
@ -338,17 +398,28 @@ class res_users(orm.Model):
def _check_validity(self, cr, uid, ids):
for user in self.browse(cr, uid, ids):
for check_string in [('Resource name', user.resource), ('Internal number', user.internal_number), ('Caller ID', user.callerid)]:
strings_to_check = [
(_('Resource Name'), user.resource),
(_('Internal Number'), user.internal_number),
(_('Caller ID'), user.callerid),
]
for check_string in strings_to_check:
if check_string[1]:
try:
plom = check_string[1].encode('ascii')
check_string[1].encode('ascii')
except UnicodeEncodeError:
raise orm.except_orm(_('Error :'), _("The '%s' for the user '%s' should only have ASCII caracters" % (check_string[0], user.name)))
raise orm.except_orm(
_('Error:'),
_("The '%s' for the user '%s' should only have "
"ASCII caracters")
% (check_string[0], user.name))
return True
_constraints = [
(_check_validity, "Error message in raise", ['resource', 'internal_number', 'callerid']),
]
_constraints = [(
_check_validity,
"Error message in raise",
['resource', 'internal_number', 'callerid']
)]
class phone_common(orm.AbstractModel):
@ -360,59 +431,56 @@ class phone_common(orm.AbstractModel):
_('Error:'),
_('Missing phone number'))
user, ast_server, ast_manager = self.pool['asterisk.server']._connect_to_asterisk(cr, uid, context=context)
user, ast_server, ast_manager = \
self.pool['asterisk.server']._connect_to_asterisk(
cr, uid, context=context)
ast_number = self.pool['asterisk.server']._reformat_number(
cr, uid, erp_number, ast_server, context=context)
# The user should have a CallerID
if not user.callerid:
raise orm.except_orm(_('Error :'), _('No callerID configured for the current user'))
raise orm.except_orm(
_('Error:'),
_('No callerID configured for the current user'))
variable = []
if user.asterisk_chan_type == 'SIP':
# We can only have one alert-info header in a SIP request
if user.alert_info:
variable.append('SIPAddHeader=Alert-Info: ' + user.alert_info)
variable.append(
'SIPAddHeader=Alert-Info: %s' % user.alert_info)
elif ast_server.alert_info:
variable.append('SIPAddHeader=Alert-Info: ' + ast_server.alert_info)
variable.append(
'SIPAddHeader=Alert-Info: %s' % ast_server.alert_info)
if user.variable:
for user_variable in user.variable.split('|'):
variable.append(user_variable.strip())
channel = '%s/%s' % (user.asterisk_chan_type, user.resource)
if user.dial_suffix:
channel += '/%s' % user.dial_suffix
try:
ast_manager.Originate(
user.asterisk_chan_type + '/' + user.resource + ( ('/' + user.dial_suffix) if user.dial_suffix else ''),
context = ast_server.context,
extension = ast_number,
priority = str(ast_server.extension_priority),
timeout = str(ast_server.wait_time*1000),
caller_id = user.callerid,
account = user.cdraccount,
variable = variable)
channel,
context=ast_server.context,
extension=ast_number,
priority=str(ast_server.extension_priority),
timeout=str(ast_server.wait_time * 1000),
caller_id=user.callerid,
account=user.cdraccount,
variable=variable)
except Exception, e:
_logger.error("Error in the Originate request to Asterisk server %s" % ast_server.ip_address)
_logger.error("Here is the detail of the error : '%s'" % unicode(e))
raise orm.except_orm(_('Error :'), _("Click to dial with Asterisk failed.\nHere is the error: '%s'" % unicode(e)))
_logger.error(
"Error in the Originate request to Asterisk server %s"
% ast_server.ip_address)
_logger.error(
"Here are the details of the error: '%s'" % unicode(e))
raise orm.except_orm(
_('Error:'),
_("Click to dial with Asterisk failed.\nHere is the error: "
"'%s'")
% unicode(e))
finally:
ast_manager.Logoff()
return True
def _prepare_incall_pop_action(
self, cr, uid, record_res, number, context=None):
# Not executed because this module doesn't depend on base_phone_popup
# TODO move to a dedicated module asterisk_popup ?
action = super(phone_common, self)._prepare_incall_pop_action(
cr, uid, record_res, number, context=context)
if not action:
action = {
'name': _('No Partner Found'),
'type': 'ir.actions.act_window',
'res_model': 'wizard.open.calling.partner',
'view_mode': 'form',
'views': [[False, 'form']], # Beurk, but needed
'target': 'new',
'context': {'incall_number_popup': number}
}
return action
return {'dialed_number': ast_number}

1
asterisk_click2dial/asterisk_click2dial_demo.xml

@ -12,7 +12,6 @@
<record id="demo_ast_server" model="asterisk.server">
<field name="name">Akretion Asterisk IPBX</field>
<field name="ip_address">asterisk.akretion.com</field>
<field name="country_prefix">33</field>
<field name="login">click2dial</field>
<field name="password">mypassword</field>
<field name="context">from-internal</field>

4
asterisk_click2dial/asterisk_server_view.xml

@ -51,9 +51,6 @@
<field name="context" />
<field name="extension_priority" />
<field name="out_prefix" />
<field name="national_prefix" />
<field name="international_prefix" />
<field name="country_prefix" />
<field name="alert_info" />
<field name="wait_time" />
</group>
@ -72,7 +69,6 @@
<field name="ip_address" />
<field name="company_id"
groups="base.group_multi_company" />
<field name="country_prefix" />
</tree>
</field>
</record>

18
asterisk_click2dial_crm_claim/__init__.py → asterisk_click2dial/controller.py

@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk Click2Dial CRM Claim module for OpenERP
# Copyright (C) 2012-2013 Akretion (http://www.akretion.com/)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Asterisk click2dial module for OpenERP
# Copyright (C) 2014 Alexis de Lattre (alexis@via.ecp.fr)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -20,4 +19,13 @@
#
##############################################################################
from . import wizard
import openerp
class AsteriskClick2dialController(openerp.addons.web.http.Controller):
_cp_path = '/asterisk_click2dial'
@openerp.addons.web.http.jsonrequest
def get_record_from_my_channel(self, req):
res = req.session.model('asterisk.server').get_record_from_my_channel()
return res

367
asterisk_click2dial/i18n/asterisk_click2dial.pot

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-21 16:21+0000\n"
"PO-Revision-Date: 2014-08-21 16:21+0000\n"
"POT-Creation-Date: 2014-08-25 21:42+0000\n"
"PO-Revision-Date: 2014-08-25 21:42+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -17,12 +17,12 @@ msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,login:0
msgid "AMI login"
msgid "AMI Login"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,password:0
msgid "AMI password"
msgid "AMI Password"
msgstr ""
#. module: asterisk_click2dial
@ -32,7 +32,7 @@ msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,alert_info:0
msgid "Alert-Info SIP header"
msgid "Alert-Info SIP Header"
msgstr ""
#. module: asterisk_click2dial
@ -45,9 +45,14 @@ msgstr ""
msgid "Asterisk CallerID"
msgstr ""
#. module: asterisk_click2dial
#: field:res.users,asterisk_chan_type:0
msgid "Asterisk Channel Type"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,ip_address:0
msgid "Asterisk IP addr. or DNS"
msgid "Asterisk IP address or DNS"
msgstr ""
#. module: asterisk_click2dial
@ -55,6 +60,16 @@ msgstr ""
msgid "Asterisk Manager Interface"
msgstr ""
#. module: asterisk_click2dial
#: field:res.users,asterisk_server_id:0
msgid "Asterisk Server"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,name:0
msgid "Asterisk Server Name"
msgstr ""
#. module: asterisk_click2dial
#: view:asterisk.server:0
msgid "Asterisk Server Search"
@ -68,11 +83,6 @@ msgstr ""
msgid "Asterisk Servers"
msgstr ""
#. module: asterisk_click2dial
#: field:res.users,asterisk_chan_type:0
msgid "Asterisk channel type"
msgstr ""
#. module: asterisk_click2dial
#: help:res.users,asterisk_chan_type:0
msgid "Asterisk channel type, as used in the Asterisk dialplan. If the user has a regular IP phone, the channel type is 'SIP'."
@ -84,23 +94,15 @@ msgid "Asterisk dialplan context from which the calls will be made. Refer to /et
msgstr ""
#. module: asterisk_click2dial
#: field:res.users,asterisk_server_id:0
msgid "Asterisk server"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,name:0
msgid "Asterisk server name"
msgstr ""
#. module: asterisk_click2dial
#: help:asterisk.server,name:0
msgid "Asterisk server name."
#: help:res.users,asterisk_server_id:0
msgid "Asterisk server on which the user's phone is connected. If you leave this field empty, it will use the first Asterisk server of the user's company."
msgstr ""
#. module: asterisk_click2dial
#: help:res.users,asterisk_server_id:0
msgid "Asterisk server on which the user's phone is connected. If you leave this field empty, it will use the first Asterisk server of the user's company."
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:26
#, python-format
msgid "BIG PB"
msgstr ""
#. module: asterisk_click2dial
@ -114,7 +116,9 @@ msgid "Call Detail Record (CDR) account used for billing this user."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:405
#: field:res.users,callerid:0
#, python-format
msgid "Caller ID"
msgstr ""
@ -124,24 +128,19 @@ msgid "Caller ID used for the calls initiated by this user."
msgstr ""
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,calling_number:0
msgid "Calling number"
#: field:number.not.found,calling_number:0
msgid "Calling Number"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:288
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:310
#, python-format
msgid "Can't get calling number from Asterisk.\n"
"Here is the error: '%s'"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Cancel"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:395
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:481
#, python-format
msgid "Click to dial with Asterisk failed.\n"
"Here is the error: '%s'"
@ -163,72 +162,30 @@ msgid "Company who uses the Asterisk server."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:248
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:255
#, python-format
msgid "Connection Test Failed!"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:257
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:264
#, python-format
msgid "Connection Test Successfull!"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:82
#, python-format
msgid "Could not get the calling number from Asterisk. Is your phone ringing or are you currently on the phone ? If yes, check your setup and look at the OpenERP debug logs."
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Create a new partner"
msgstr ""
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,current_mobile:0
msgid "Current mobile"
msgstr ""
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,current_phone:0
msgid "Current phone"
msgstr ""
#. module: asterisk_click2dial
#: selection:res.users,asterisk_chan_type:0
msgid "DAHDI"
msgstr ""
#. module: asterisk_click2dial
#: view:asterisk.server:0
msgid "Dialplan Parameters"
#: field:asterisk.server,context:0
msgid "Dialplan Context"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,context:0
msgid "Dialplan context"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:88
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:90
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:92
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:94
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:100
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:198
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:217
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:221
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:233
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:288
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:346
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:369
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:395
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:81
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:95
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:189
#, python-format
msgid "Error :"
#: view:asterisk.server:0
msgid "Dialplan Parameters"
msgstr ""
#. module: asterisk_click2dial
@ -238,14 +195,34 @@ msgid "Error message in raise"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:360
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:109
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:114
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:119
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:124
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:133
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:191
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:212
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:218
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:238
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:308
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:413
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:432
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:444
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:480
#, python-format
msgid "Error:"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,extension_priority:0
msgid "Extension priority"
msgid "Extension Priority"
msgstr ""
#. module: asterisk_click2dial
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:25
#, python-format
msgid "Fail"
msgstr ""
#. module: asterisk_click2dial
@ -254,7 +231,7 @@ msgid "H323"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:249
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:256
#, python-format
msgid "Here is the error message: %s"
msgstr ""
@ -270,19 +247,10 @@ msgid "IP address or DNS name of the Asterisk server."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:404
#: field:res.users,internal_number:0
msgid "Internal number"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,international_prefix:0
msgid "International prefix"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:118
#, python-format
msgid "Invalid phone number"
msgid "Internal Number"
msgstr ""
#. module: asterisk_click2dial
@ -301,98 +269,74 @@ msgid "MGCP"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:361
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:433
#, python-format
msgid "Missing phone number"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,country_prefix:0
msgid "My country prefix"
msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,national_prefix:0
msgid "National prefix"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:198
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:45
#, python-format
msgid "No Asterisk server configured for the company '%s'."
msgid "Moving to %s ID %d"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:410
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:192
#, python-format
msgid "No Partner Found"
msgid "No Asterisk server configured for the company '%s'."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:369
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:445
#, python-format
msgid "No callerID configured for the current user"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:217
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:213
#, python-format
msgid "No channel type configured for the current user."
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "No partner found in OpenERP with this number"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:221
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:219
#, python-format
msgid "No resource name configured for the current user"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:88
#, python-format
msgid "Only use digits for the '%s' on the Asterisk server '%s'"
msgstr ""
#. module: asterisk_click2dial
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:20
#: code:addons/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml:13
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:31
#, python-format
msgid "Open Calling Partner"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Open Parent Partner form"
msgid "Number Not Found"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Open Partner form"
#: model:ir.model,name:asterisk_click2dial.model_number_not_found
msgid "Number not found"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Open Related Invoices"
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:111
#, python-format
msgid "Only use digits for the '%s' on the Asterisk server '%s'"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Open Related Sale Orders"
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml:13
#, python-format
msgid "Open Caller"
msgstr ""
#. module: asterisk_click2dial
#: model:ir.model,name:asterisk_click2dial.model_wizard_open_calling_partner
#: view:wizard.open.calling.partner:0
msgid "Open calling partner"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:258
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:265
#, python-format
msgid "OpenERP can successfully login to the Asterisk Manager Interface."
msgstr ""
@ -404,17 +348,7 @@ msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,out_prefix:0
msgid "Out prefix"
msgstr ""
#. module: asterisk_click2dial
#: help:wizard.open.calling.partner,parent_partner_id:0
msgid "Parent Partner related to the calling number."
msgstr ""
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,parent_partner_id:0
msgid "Parent partner"
msgid "Out Prefix"
msgstr ""
#. module: asterisk_click2dial
@ -423,23 +357,13 @@ msgid "Partner"
msgstr ""
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,partner_id:0
msgid "Partner name"
#: help:number.not.found,to_update_partner_id:0
msgid "Partner on which the phone number will be written"
msgstr ""
#. module: asterisk_click2dial
#: help:wizard.open.calling.partner,to_update_partner_id:0
msgid "Partner on which the phone or mobile number will be written"
msgstr ""
#. module: asterisk_click2dial
#: help:wizard.open.calling.partner,partner_id:0
msgid "Partner related to the calling number."
msgstr ""
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,to_update_partner_id:0
msgid "Partner to update"
#: field:number.not.found,to_update_partner_id:0
msgid "Partner to Update"
msgstr ""
#. module: asterisk_click2dial
@ -448,13 +372,8 @@ msgid "Password that OpenERP will use to communicate with the Asterisk Manager I
msgstr ""
#. module: asterisk_click2dial
#: help:wizard.open.calling.partner,calling_number:0
msgid "Phone number of calling party that has been obtained from Asterisk."
msgstr ""
#. module: asterisk_click2dial
#: help:asterisk.server,country_prefix:0
msgid "Phone prefix of the country where the Asterisk server is located. For e.g. the phone prefix for France is '33'. If the phone number to dial starts with the 'My country prefix', OpenERP will remove the country prefix from the phone number and add the 'out prefix' followed by the 'national prefix'. If the phone number to dial doesn't start with the 'My country prefix', OpenERP will add the 'out prefix' followed by the 'international prefix'."
#: help:number.not.found,calling_number:0
msgid "Phone number of calling party that has been obtained from Asterisk, in the format used by Asterisk (not E.164)."
msgstr ""
#. module: asterisk_click2dial
@ -462,19 +381,9 @@ msgstr ""
msgid "Port"
msgstr ""
#. module: asterisk_click2dial
#: help:asterisk.server,national_prefix:0
msgid "Prefix for national phone calls (don't include the 'out prefix'). For e.g., in France, the phone numbers look like '01 41 98 12 42' : the National prefix is '0'."
msgstr ""
#. module: asterisk_click2dial
#: help:asterisk.server,international_prefix:0
msgid "Prefix to add to make international phone calls (don't include the 'out prefix'). For e.g., in France, the International prefix is '00'."
msgstr ""
#. module: asterisk_click2dial
#: help:asterisk.server,out_prefix:0
msgid "Prefix to dial to place outgoing calls. If you don't use a prefix to place outgoing calls, leave empty."
msgid "Prefix to dial to make outgoing calls. If you don't use a prefix to make outgoing calls, leave empty."
msgstr ""
#. module: asterisk_click2dial
@ -483,14 +392,16 @@ msgid "Priority of the extension in the Asterisk dialplan. Refer to /etc/asteris
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:233
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:239
#, python-format
msgid "Problem in the request from OpenERP to Asterisk. Here is the error message: %s"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:403
#: field:res.users,resource:0
msgid "Resource name"
#, python-format
msgid "Resource Name"
msgstr ""
#. module: asterisk_click2dial
@ -508,12 +419,6 @@ msgstr ""
msgid "SIP"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:189
#, python-format
msgid "Select the partner to update."
msgstr ""
#. module: asterisk_click2dial
#: view:asterisk.server:0
msgid "Server Name"
@ -544,6 +449,13 @@ msgstr ""
msgid "Standard Asterisk Parameters"
msgstr ""
#. module: asterisk_click2dial
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:44
#, python-format
msgid "Success"
msgstr ""
#. module: asterisk_click2dial
#: help:asterisk.server,port:0
msgid "TCP port on which the Asterisk Manager Interface listens. Defined in /etc/asterisk/manager.conf on Asterisk."
@ -555,19 +467,19 @@ msgid "Test Connection to Asterisk"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:346
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:414
#, python-format
msgid "The '%s' for the user '%s' should only have ASCII caracters"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:100
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:136
#, python-format
msgid "The '%s' should only have ASCII caracters for the Asterisk server '%s'"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:92
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:120
#, python-format
msgid "The 'extension priority' must be a positive value for the Asterisk server '%s'"
msgstr ""
@ -577,45 +489,6 @@ msgstr ""
msgid "The active field allows you to hide the Asterisk server without deleting it."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:95
#, python-format
msgid "The object '%s' is not found in your OpenERP database, probably because the related module is not installed."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:121
#, python-format
msgid "The phone number is not written in valid format."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:119
#, python-format
msgid "The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:120
#, python-format
msgid "The phone number is not written in valid national format."
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Update an existing partner"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Update mobile"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Update phone"
msgstr ""
#. module: asterisk_click2dial
#: help:res.users,internal_number:0
msgid "User's internal phone number."
@ -623,17 +496,17 @@ msgstr ""
#. module: asterisk_click2dial
#: field:res.users,alert_info:0
msgid "User-specific Alert-Info SIP header"
msgid "User-specific Alert-Info SIP Header"
msgstr ""
#. module: asterisk_click2dial
#: field:res.users,variable:0
msgid "User-specific Variable"
#: field:res.users,dial_suffix:0
msgid "User-specific Dial Suffix"
msgstr ""
#. module: asterisk_click2dial
#: field:res.users,dial_suffix:0
msgid "User-specific dial suffix"
#: field:res.users,variable:0
msgid "User-specific Variable"
msgstr ""
#. module: asterisk_click2dial
@ -648,17 +521,17 @@ msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,wait_time:0
msgid "Wait time (sec)"
msgid "Wait Time (sec)"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:90
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:115
#, python-format
msgid "You should set a 'Wait time' value between 1 and 120 seconds for the Asterisk server '%s'"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:94
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:125
#, python-format
msgid "You should set a TCP port between 1 and 65535 for the Asterisk server '%s'"
msgstr ""
@ -678,13 +551,3 @@ msgstr ""
msgid "phone.common"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "with calling number as mobile"
msgstr ""
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "with calling number as phone"
msgstr ""

413
asterisk_click2dial/i18n/fr.po

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-21 16:22+0000\n"
"PO-Revision-Date: 2014-08-21 16:22+0000\n"
"POT-Creation-Date: 2014-08-25 21:43+0000\n"
"PO-Revision-Date: 2014-08-25 21:43+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -17,12 +17,12 @@ msgstr ""
#. module: asterisk_click2dial
#: field:asterisk.server,login:0
msgid "AMI login"
msgid "AMI Login"
msgstr "Nom d'utilisateur AMI"
#. module: asterisk_click2dial
#: field:asterisk.server,password:0
msgid "AMI password"
msgid "AMI Password"
msgstr "Mot de passe AMI"
#. module: asterisk_click2dial
@ -32,8 +32,8 @@ msgstr "Actif"
#. module: asterisk_click2dial
#: field:asterisk.server,alert_info:0
msgid "Alert-Info SIP header"
msgstr "En-tête SIP Alert-Info SIP"
msgid "Alert-Info SIP Header"
msgstr "En-tête SIP Alert-Info"
#. module: asterisk_click2dial
#: help:asterisk.server,wait_time:0
@ -45,16 +45,31 @@ msgstr "Temps (en secondes) pendant lequel Asterisk essayera de joindre le tél
msgid "Asterisk CallerID"
msgstr "Asterisk CallerID"
#. module: asterisk_click2dial
#: field:res.users,asterisk_chan_type:0
msgid "Asterisk Channel Type"
msgstr "Type de canal Asterisk"
#. module: asterisk_click2dial
#: field:asterisk.server,ip_address:0
msgid "Asterisk IP addr. or DNS"
msgstr "Adr. IP ou DNS d'Asterisk"
msgid "Asterisk IP address or DNS"
msgstr "Adresse IP ou DNS d'Asterisk"
#. module: asterisk_click2dial
#: view:asterisk.server:0
msgid "Asterisk Manager Interface"
msgstr "Asterisk Manager Interface"
#. module: asterisk_click2dial
#: field:res.users,asterisk_server_id:0
msgid "Asterisk Server"
msgstr "Serveur Asterisk"
#. module: asterisk_click2dial
#: field:asterisk.server,name:0
msgid "Asterisk Server Name"
msgstr "Nom du serveur Asterisk"
#. module: asterisk_click2dial
#: view:asterisk.server:0
msgid "Asterisk Server Search"
@ -68,11 +83,6 @@ msgstr "Recherche de serveur Asterisk"
msgid "Asterisk Servers"
msgstr "Serveurs Asterisk"
#. module: asterisk_click2dial
#: field:res.users,asterisk_chan_type:0
msgid "Asterisk channel type"
msgstr "Type de canal Asterisk"
#. module: asterisk_click2dial
#: help:res.users,asterisk_chan_type:0
msgid "Asterisk channel type, as used in the Asterisk dialplan. If the user has a regular IP phone, the channel type is 'SIP'."
@ -83,26 +93,18 @@ msgstr "Type de canal Asterisk, tel qu'utilisé dans le dialplan d'Asterisk. Si
msgid "Asterisk dialplan context from which the calls will be made. Refer to /etc/asterisk/extensions.conf on your Asterisk server."
msgstr "Contexte du dialplan d'Asterisk depuis lequel les appels seront initiés. Cf /etc/asterisk/extensions.conf sur le serveur Asterisk."
#. module: asterisk_click2dial
#: field:res.users,asterisk_server_id:0
msgid "Asterisk server"
msgstr "Serveur Asterisk"
#. module: asterisk_click2dial
#: field:asterisk.server,name:0
msgid "Asterisk server name"
msgstr "Nom du serveur Asterisk"
#. module: asterisk_click2dial
#: help:asterisk.server,name:0
msgid "Asterisk server name."
msgstr "Nom du serveur Asterisk."
#. module: asterisk_click2dial
#: help:res.users,asterisk_server_id:0
msgid "Asterisk server on which the user's phone is connected. If you leave this field empty, it will use the first Asterisk server of the user's company."
msgstr "Serveur Asterisk sur lequel le téléphone de l'utilisateur est connecté. Si vous laissez ce champ vide, le premier serveur Asterisk de la société de l'utilisateur sera utilisé."
#. module: asterisk_click2dial
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:26
#, python-format
msgid "BIG PB"
msgstr "BIG PB"
#. module: asterisk_click2dial
#: field:res.users,cdraccount:0
msgid "CDR Account"
@ -114,7 +116,9 @@ msgid "Call Detail Record (CDR) account used for billing this user."
msgstr "Compte CDR utilisé pour facturer cet utilisateur (CDR = Journal d'appel détaillé)."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:405
#: field:res.users,callerid:0
#, python-format
msgid "Caller ID"
msgstr "Identification de l'appelant"
@ -124,12 +128,12 @@ msgid "Caller ID used for the calls initiated by this user."
msgstr "'Caller ID' des appels passés par l'utilisateur."
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,calling_number:0
msgid "Calling number"
#: field:number.not.found,calling_number:0
msgid "Calling Number"
msgstr "Numéro appelant"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:288
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:310
#, python-format
msgid "Can't get calling number from Asterisk.\n"
"Here is the error: '%s'"
@ -137,12 +141,7 @@ msgstr "Le numéro de l'appelant n'a pas pu être récupéré auprès d'Asterisk
"Voilà l'erreur : '%s'"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Cancel"
msgstr "Annuler"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:395
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:481
#, python-format
msgid "Click to dial with Asterisk failed.\n"
"Here is the error: '%s'"
@ -165,73 +164,31 @@ msgid "Company who uses the Asterisk server."
msgstr "Société qui utilise le serveur Asterisk."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:248
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:255
#, python-format
msgid "Connection Test Failed!"
msgstr "Connection Test Failed!"
msgstr "Echec du test de connexion !"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:257
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:264
#, python-format
msgid "Connection Test Successfull!"
msgstr "Connection Test Successfull!"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:82
#, python-format
msgid "Could not get the calling number from Asterisk. Is your phone ringing or are you currently on the phone ? If yes, check your setup and look at the OpenERP debug logs."
msgstr "OpenERP n'a pas pu obtenir le numéro de l'appelant auprès d'Asterisk. Votre téléphone est-il bien entrain de sonner ou êtes-vous bien au téléphone actuellement ? Si oui, vérifiez les paramètres de configuration et consultez les logs de debug d'OpenERP."
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Create a new partner"
msgstr "Créer un nouveau partenaire"
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,current_mobile:0
msgid "Current mobile"
msgstr "Tél. portable actuel"
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,current_phone:0
msgid "Current phone"
msgstr "Tél. actuel"
msgstr "Test de connexion réussi !"
#. module: asterisk_click2dial
#: selection:res.users,asterisk_chan_type:0
msgid "DAHDI"
msgstr "DAHDI"
#. module: asterisk_click2dial
#: view:asterisk.server:0
msgid "Dialplan Parameters"
msgstr "Dialplan Parameters"
#. module: asterisk_click2dial
#: field:asterisk.server,context:0
msgid "Dialplan context"
msgid "Dialplan Context"
msgstr "Contexte du dialplan"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:88
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:90
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:92
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:94
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:100
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:198
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:217
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:221
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:233
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:288
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:346
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:369
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:395
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:81
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:95
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:189
#, python-format
msgid "Error :"
msgstr "Erreur :"
#: view:asterisk.server:0
msgid "Dialplan Parameters"
msgstr "Paramètres du dialplan"
#. module: asterisk_click2dial
#: constraint:asterisk.server:0
@ -240,26 +197,46 @@ msgid "Error message in raise"
msgstr "Error message in raise"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:360
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:109
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:114
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:119
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:124
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:133
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:191
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:212
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:218
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:238
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:308
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:413
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:432
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:444
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:480
#, python-format
msgid "Error:"
msgstr "Error:"
msgstr "Erreur :"
#. module: asterisk_click2dial
#: field:asterisk.server,extension_priority:0
msgid "Extension priority"
msgid "Extension Priority"
msgstr "Priorité de l'extension"
#. module: asterisk_click2dial
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:25
#, python-format
msgid "Fail"
msgstr "Fail"
#. module: asterisk_click2dial
#: selection:res.users,asterisk_chan_type:0
msgid "H323"
msgstr "H323"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:249
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:256
#, python-format
msgid "Here is the error message: %s"
msgstr "Here is the error message: %s"
msgstr "Voilà le message d'erreur : %s"
#. module: asterisk_click2dial
#: selection:res.users,asterisk_chan_type:0
@ -272,20 +249,11 @@ msgid "IP address or DNS name of the Asterisk server."
msgstr "Adresse IP ou DNS du serveur Asterisk."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:404
#: field:res.users,internal_number:0
msgid "Internal number"
msgstr "Numéro interne"
#. module: asterisk_click2dial
#: field:asterisk.server,international_prefix:0
msgid "International prefix"
msgstr "Préfixe international"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:118
#, python-format
msgid "Invalid phone number"
msgstr "Numéro de téléphone invalide"
msgid "Internal Number"
msgstr "Numéro interne"
#. module: asterisk_click2dial
#: selection:res.users,asterisk_chan_type:0
@ -303,121 +271,87 @@ msgid "MGCP"
msgstr "MGCP"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:361
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:433
#, python-format
msgid "Missing phone number"
msgstr "Missing phone number"
msgstr "Numéro de téléphone manquant"
#. module: asterisk_click2dial
#: field:asterisk.server,country_prefix:0
msgid "My country prefix"
msgstr "Préfixe du pays"
#. module: asterisk_click2dial
#: field:asterisk.server,national_prefix:0
msgid "National prefix"
msgstr "Préfixe national"
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:45
#, python-format
msgid "Moving to %s ID %d"
msgstr "Moving to %s ID %d"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:198
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:192
#, python-format
msgid "No Asterisk server configured for the company '%s'."
msgstr "Aucun serveur Asterisk n'est associé à la société '%s'."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:410
#, python-format
msgid "No Partner Found"
msgstr "No Partner Found"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:369
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:445
#, python-format
msgid "No callerID configured for the current user"
msgstr "Le callerID n'est pas configuré pour l'utilisateur courant"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:217
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:213
#, python-format
msgid "No channel type configured for the current user."
msgstr "Aucun type de canal n'est configuré pour l'utilisateur actuel."
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "No partner found in OpenERP with this number"
msgstr "Aucun partenaire trouvé dans OpenERP avec ce numéro"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:221
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:219
#, python-format
msgid "No resource name configured for the current user"
msgstr "Aucun nom de ressource n'a été renseigné pour l'utilisateur actuel"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:88
#, python-format
msgid "Only use digits for the '%s' on the Asterisk server '%s'"
msgstr "N'utilisez que des chiffres pour le '%s' du serveur Asterisk '%s'"
#. module: asterisk_click2dial
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:20
#: code:addons/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml:13
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:31
#, python-format
msgid "Open Calling Partner"
msgstr "Open Calling Partner"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Open Parent Partner form"
msgstr "Ouvrir la fiche du partenaire parent"
msgid "Number Not Found"
msgstr "Numéro introuvable"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Open Partner form"
msgstr "Ouvrir le fiche Partenaire"
#: model:ir.model,name:asterisk_click2dial.model_number_not_found
msgid "Number not found"
msgstr "Numéro introuvable"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Open Related Invoices"
msgstr "Ouvrir les factures associées"
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:111
#, python-format
msgid "Only use digits for the '%s' on the Asterisk server '%s'"
msgstr "N'utilisez que des chiffres pour le '%s' du serveur Asterisk '%s'"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Open Related Sale Orders"
msgstr "Ouvrir les commandes associées"
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml:13
#, python-format
msgid "Open Caller"
msgstr "Ouvrir l'appelant"
#. module: asterisk_click2dial
#: model:ir.model,name:asterisk_click2dial.model_wizard_open_calling_partner
#: view:wizard.open.calling.partner:0
msgid "Open calling partner"
msgstr "Ouvrir le partenaire appelant"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:258
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:265
#, python-format
msgid "OpenERP can successfully login to the Asterisk Manager Interface."
msgstr "OpenERP can successfully login to the Asterisk Manager Interface."
msgstr "OpenERP s'authentifie avec succès à l'Asterisk Manager Interface."
#. module: asterisk_click2dial
#: view:res.users:0
msgid "Optional Asterisk Parameters - for experts only, can be left empty"
msgstr "Optional Asterisk Parameters - for experts only, can be left empty"
msgstr "Paramètres Asterisk optionnels - pour les experts uniquement, peut être laissé vide"
#. module: asterisk_click2dial
#: field:asterisk.server,out_prefix:0
msgid "Out prefix"
msgstr "Préfixe pour l'extérieur"
#. module: asterisk_click2dial
#: help:wizard.open.calling.partner,parent_partner_id:0
msgid "Parent Partner related to the calling number."
msgstr "Partenaire parent associé au numéro appelant."
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,parent_partner_id:0
msgid "Parent partner"
msgstr "Partenaire parent"
msgid "Out Prefix"
msgstr "Préfixe de sortie"
#. module: asterisk_click2dial
#: model:ir.model,name:asterisk_click2dial.model_res_partner
@ -425,23 +359,13 @@ msgid "Partner"
msgstr "Partenaire"
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,partner_id:0
msgid "Partner name"
msgstr "Nom du Partenaire"
#. module: asterisk_click2dial
#: help:wizard.open.calling.partner,to_update_partner_id:0
msgid "Partner on which the phone or mobile number will be written"
msgstr "Partenaire sur lequel le numéro de téléphone fixe ou de téléphone portable sera écrit"
#. module: asterisk_click2dial
#: help:wizard.open.calling.partner,partner_id:0
msgid "Partner related to the calling number."
msgstr "Partenaire associé au numéro de téléphone appelant."
#: help:number.not.found,to_update_partner_id:0
msgid "Partner on which the phone number will be written"
msgstr "Partenaire sur lequel le numéro de téléphone sera écrit"
#. module: asterisk_click2dial
#: field:wizard.open.calling.partner,to_update_partner_id:0
msgid "Partner to update"
#: field:number.not.found,to_update_partner_id:0
msgid "Partner to Update"
msgstr "Partenaire à mettre à jour"
#. module: asterisk_click2dial
@ -450,34 +374,19 @@ msgid "Password that OpenERP will use to communicate with the Asterisk Manager I
msgstr "Mot de passe qui sera utilisé par OpenERP pour communiquer avec l'Asterisk Manager Interface. Ce mot de passe est configuré dans le fichier /etc/asterisk/manager.conf sur votre serveur Asterisk."
#. module: asterisk_click2dial
#: help:wizard.open.calling.partner,calling_number:0
msgid "Phone number of calling party that has been obtained from Asterisk."
msgstr "Numéro de téléphone de l'appelant obtenu auprès d'Asterisk."
#. module: asterisk_click2dial
#: help:asterisk.server,country_prefix:0
msgid "Phone prefix of the country where the Asterisk server is located. For e.g. the phone prefix for France is '33'. If the phone number to dial starts with the 'My country prefix', OpenERP will remove the country prefix from the phone number and add the 'out prefix' followed by the 'national prefix'. If the phone number to dial doesn't start with the 'My country prefix', OpenERP will add the 'out prefix' followed by the 'international prefix'."
msgstr "Préfixe téléphonique du pays dans lequel est situé le serveur Asterisk. Par exemple, le préfixe téléphonique de la France est '33'. Si le numéro de téléphone à appeler commence par le préfixe du pays, OpenERP supprimera ce préfixe du numéro de téléphone à composer et ajoutera le préfixe pour l'extérieur suivi par le préfixe national. Si le numéro de téléphone à appeler ne commence pas par le préfixe du pays, OpenERP ajoutera le préfixe pour l'extérieur suivi par le préfixe international."
#: help:number.not.found,calling_number:0
msgid "Phone number of calling party that has been obtained from Asterisk, in the format used by Asterisk (not E.164)."
msgstr "Phone number of calling party that has been obtained from Asterisk, in the format used by Asterisk (not E.164)."
#. module: asterisk_click2dial
#: field:asterisk.server,port:0
msgid "Port"
msgstr "Port"
#. module: asterisk_click2dial
#: help:asterisk.server,national_prefix:0
msgid "Prefix for national phone calls (don't include the 'out prefix'). For e.g., in France, the phone numbers look like '01 41 98 12 42' : the National prefix is '0'."
msgstr "Préfixe pour les appels nationaux (ne pas inclure le préfixe pour l'extérieur). Par exemple, en France, les numéros de téléphone sont du type '01 41 98 12 42' ; le préfixe national est '0'."
#. module: asterisk_click2dial
#: help:asterisk.server,international_prefix:0
msgid "Prefix to add to make international phone calls (don't include the 'out prefix'). For e.g., in France, the International prefix is '00'."
msgstr "Préfixe à ajouter pour passer des appels vers l'étranger (ne pas inclure le préfixe pour l'extérieur). Par exemple, en France, le préfixe pour l'international est '00'."
#. module: asterisk_click2dial
#: help:asterisk.server,out_prefix:0
msgid "Prefix to dial to place outgoing calls. If you don't use a prefix to place outgoing calls, leave empty."
msgstr "Préfixe à composer pour appeler vers l'extérieur. Si vous n'avez pas à composer un préfixe pour appeler vers l'extérieur, laissez vide."
msgid "Prefix to dial to make outgoing calls. If you don't use a prefix to make outgoing calls, leave empty."
msgstr "Préfixe à composer pour les appels vers l'extérieur. Si vous n'utilisez pas de préfixe pour les appels vers l'extérieur, laissez vide."
#. module: asterisk_click2dial
#: help:asterisk.server,extension_priority:0
@ -485,14 +394,16 @@ msgid "Priority of the extension in the Asterisk dialplan. Refer to /etc/asteris
msgstr "Priorité de l'extension dans le dialplan d'Asterisk. Cf /etc/asterisk/extensions.conf sur le serveur Asterisk."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:233
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:239
#, python-format
msgid "Problem in the request from OpenERP to Asterisk. Here is the error message: %s"
msgstr "Problem in the request from OpenERP to Asterisk. Here is the error message: %s"
msgstr "Problème dans la requête d'OpenERP vers Asterisk. Voilà le message d'erreur : %s"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:403
#: field:res.users,resource:0
msgid "Resource name"
#, python-format
msgid "Resource Name"
msgstr "Nom de la ressource"
#. module: asterisk_click2dial
@ -510,12 +421,6 @@ msgstr "SCCP"
msgid "SIP"
msgstr "SIP"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:189
#, python-format
msgid "Select the partner to update."
msgstr "Sélectionnez le partenaire à mettre à jour."
#. module: asterisk_click2dial
#: view:asterisk.server:0
msgid "Server Name"
@ -544,7 +449,14 @@ msgstr "Skinny"
#. module: asterisk_click2dial
#: view:res.users:0
msgid "Standard Asterisk Parameters"
msgstr "Standard Asterisk Parameters"
msgstr "Paramètres Asterisk standards"
#. module: asterisk_click2dial
#. openerp-web
#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:44
#, python-format
msgid "Success"
msgstr "Succès"
#. module: asterisk_click2dial
#: help:asterisk.server,port:0
@ -557,19 +469,19 @@ msgid "Test Connection to Asterisk"
msgstr "Test de connexion à Asterisk"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:346
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:414
#, python-format
msgid "The '%s' for the user '%s' should only have ASCII caracters"
msgstr "Le '%s' pour l'utilisateur '%s' ne devrait contenir que des caractères ASCII"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:100
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:136
#, python-format
msgid "The '%s' should only have ASCII caracters for the Asterisk server '%s'"
msgstr "Le '%s' ne doit contenir que des caractères ASCII pour le serveur Asterisk '%s'"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:92
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:120
#, python-format
msgid "The 'extension priority' must be a positive value for the Asterisk server '%s'"
msgstr "Le paramètre 'Priorité de l'extension' doit être un entier positif pour le serveur Asterisk '%s'"
@ -579,45 +491,6 @@ msgstr "Le paramètre 'Priorité de l'extension' doit être un entier positif po
msgid "The active field allows you to hide the Asterisk server without deleting it."
msgstr "Le champ Actif permet de cacher le serveur Asterisk sans le supprimer."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:95
#, python-format
msgid "The object '%s' is not found in your OpenERP database, probably because the related module is not installed."
msgstr "The object '%s' is not found in your OpenERP database, probably because the related module is not installed."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:121
#, python-format
msgid "The phone number is not written in valid format."
msgstr "Le numéro de téléphone n'est pas dans un format valide."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:119
#, python-format
msgid "The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42"
msgstr "Le numéro de téléphone n'est pas dans un format international valide. Exemple de numéro de téléphone dans un format international valide : +33 1 41 98 12 42"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:120
#, python-format
msgid "The phone number is not written in valid national format."
msgstr "Le numéro de téléphone n'est pas dans un format national valide."
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Update an existing partner"
msgstr "Mettre à jour un partenaire existant"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Update mobile"
msgstr "Mettre à jour le portable"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "Update phone"
msgstr "Mettre à jour le tél."
#. module: asterisk_click2dial
#: help:res.users,internal_number:0
msgid "User's internal phone number."
@ -625,19 +498,19 @@ msgstr "Numéro de téléphone interne de l'utilisateur."
#. module: asterisk_click2dial
#: field:res.users,alert_info:0
msgid "User-specific Alert-Info SIP header"
msgid "User-specific Alert-Info SIP Header"
msgstr "En-tête SIP Alert-Info spécifique à l'utilisateur"
#. module: asterisk_click2dial
#: field:res.users,dial_suffix:0
msgid "User-specific Dial Suffix"
msgstr "Suffixe d'appel spécifique à l'utilisateur"
#. module: asterisk_click2dial
#: field:res.users,variable:0
msgid "User-specific Variable"
msgstr "Variable spécifique à l'utilisateur"
#. module: asterisk_click2dial
#: field:res.users,dial_suffix:0
msgid "User-specific dial suffix"
msgstr "Suffixe d'appel spécifique à l'utilisateur"
#. module: asterisk_click2dial
#: help:res.users,dial_suffix:0
msgid "User-specific dial suffix such as aa=2wb for SCCP auto answer."
@ -650,17 +523,17 @@ msgstr "Utilisateurs"
#. module: asterisk_click2dial
#: field:asterisk.server,wait_time:0
msgid "Wait time (sec)"
msgid "Wait Time (sec)"
msgstr "Temps d'attente (sec)"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:90
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:115
#, python-format
msgid "You should set a 'Wait time' value between 1 and 120 seconds for the Asterisk server '%s'"
msgstr "Vous devez indiquer une valeur comprise entre 1 et 120 secondes pour le paramètre 'Temps d'attente' pour le serveur Asterisk '%s'"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:94
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:125
#, python-format
msgid "You should set a TCP port between 1 and 65535 for the Asterisk server '%s'"
msgstr "Vous devez mettre un port TCP entre 1 et 65535 pour le serveur Asterisk '%s'"
@ -680,13 +553,3 @@ msgstr "mISDN"
msgid "phone.common"
msgstr "phone.common"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "with calling number as mobile"
msgstr "avec le numéro appelant comme portable"
#. module: asterisk_click2dial
#: view:wizard.open.calling.partner:0
msgid "with calling number as phone"
msgstr "avec le numéro appelant comme tél."

27
asterisk_click2dial/scripts/openerp_popup_timeout.sh

@ -0,0 +1,27 @@
#! /bin/sh
# -*- encoding: utf-8 -*-
#
# Written by Alexis de Lattre <alexis.delattre@akretion.com>
# Example of wrapper for set_name_agi.py which makes sure that the
# script doesn't take too much time to execute
# Limiting the execution time of set_name_agi.py is important because
# the script is designed to be executed at the beginning of each
# incoming or outgoing phone call... and if the script get stucks, the
# phone call will also get stucks !
# For Debian Lenny and Ubuntu Lucid, you need to install the package "timeout"
# For Ubuntu >= Maverick and Debian >= Squeeze, the "timeout" command is shipped
# in the "coreutils" package
# The first argument of the "timeout" command is the maximum execution time
# In this example, we chose 2 seconds.
# To test this script manually (i.e. outside of Asterisk), run :
# echo "agi_callerid:0141401242"|openerp_popup_timeout.sh
# where 0141401242 is a phone number that could be presented by the calling party
PATH=/usr/local/sbin:/usr/local/bin:/var/lib/asterisk/agi-bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/share/asterisk/agi-bin
timeout 2s set_name_agi.py --server openerp.mycompany.com --database erp_prod --user-id 12 --password "thepasswd" --notify admin demo

77
asterisk_click2dial/scripts/set_name_agi.py

@ -108,20 +108,66 @@ not_found_name = "Not in OpenERP"
# Define command line options
options = [
{'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},
{'names': ('-p', '--port'), 'dest': 'port', 'type': 'int', 'help': "Port of OpenERP's XML-RPC interface. Default = 8069", 'action': 'store', 'default': 8069},
{'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},
{'names': ('-d', '--database'), 'dest': 'database', 'type': 'string', 'help': "OpenERP database name. Default = 'openerp'", 'action': 'store', 'default': 'openerp'},
{'names': ('-u', '--user-id'), 'dest': 'user', 'type': 'int', 'help': "OpenERP user ID to use when connecting to OpenERP. Default = 2", 'action': 'store', 'default': 2},
{'names': ('-w', '--password'), 'dest': 'password', 'type': 'string', 'help': "Password of the OpenERP user. Default = 'demo'", 'action': 'store', 'default': 'demo'},
{'names': ('-a', '--ascii'), 'dest': 'ascii', 'help': "Convert name from UTF-8 to ASCII. Default = no, keep UTF-8", 'action': 'store_true', 'default': False},
{'names': ('-n', '--notify'), 'dest': 'notify', 'help': "Notify OpenERP users via a pop-up (requires the OpenERP module 'base_phone_popup'). If you use this option, you must pass the logins of the OpenERP users to notify as argument to the script. Default = no", 'action': 'store_true', 'default': False},
{'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},
{'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"},
{'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"},
{'names': ('-o', '--outgoing'), 'dest': 'outgoing', 'help': "Update the Connected Line ID name on outgoing calls via a call to the Asterisk function CONNECTEDLINE(), instead of updating the Caller ID name on incoming calls. Default = no.", 'action': 'store_true', 'default': False},
{'names': ('-i', '--outgoing-agi-variable'), 'dest': 'outgoing_agi_var', 'help': "Enter the name of the AGI variable (without the 'agi_' prefix) from which the script will get the phone number dialed by the user on outgoing calls. For example, with Xivo, you should specify 'dnid' as the AGI variable. Default = 'extension'", 'action': 'store', 'default': "extension"},
{'names': ('-m', '--max-size'), 'dest': 'max_size', 'type': 'int', 'help': "If the name has more characters this maximum size, cut it to this maximum size. Default = 40", 'action': 'store', 'default': 40},
{'names': ('-s', '--server'), 'dest': 'server', 'type': 'string',
'action': 'store', 'default': False,
'help': 'DNS or IP address of the OpenERP server. Default = none '
'(will not try to connect to OpenERP)'},
{'names': ('-p', '--port'), 'dest': 'port', 'type': 'int',
'action': 'store', 'default': 8069,
'help': "Port of OpenERP's XML-RPC interface. Default = 8069"},
{'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},
{'names': ('-d', '--database'), 'dest': 'database', 'type': 'string',
'action': 'store', 'default': 'openerp',
'help': "OpenERP database name. Default = 'openerp'"},
{'names': ('-u', '--user-id'), 'dest': 'user', 'type': 'int',
'action': 'store', 'default': 2,
'help': "OpenERP user ID to use when connecting to OpenERP. "
"Default = 2"},
{'names': ('-w', '--password'), 'dest': 'password', 'type': 'string',
'action': 'store', 'default': 'demo',
'help': "Password of the OpenERP user. Default = 'demo'"},
{'names': ('-a', '--ascii'), 'dest': 'ascii',
'action': 'store_true', 'default': False,
'help': "Convert name from UTF-8 to ASCII. Default = no, keep UTF-8"},
{'names': ('-n', '--notify'), 'dest': 'notify',
'action': 'store_true', 'default': False,
'help': "Notify OpenERP users via a pop-up (requires the OpenERP "
"module 'base_phone_popup'). If you use this option, you must pass "
"the logins of the OpenERP users to notify as argument to the "
"script. Default = no"},
{'names': ('-g', '--geoloc'), 'dest': 'geoloc',
'action': 'store_true', 'default': False,
'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"},
{'names': ('-l', '--geoloc-lang'), 'dest': 'lang', 'type': 'string',
'action': 'store', 'default': "en",
'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'"},
{'names': ('-c', '--geoloc-country'), 'dest': 'country', 'type': 'string',
'action': 'store', 'default': "FR",
'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'"},
{'names': ('-o', '--outgoing'), 'dest': 'outgoing',
'action': 'store_true', 'default': False,
'help': "Update the Connected Line ID name on outgoing calls via a "
"call to the Asterisk function CONNECTEDLINE(), instead of updating "
"the Caller ID name on incoming calls. Default = no."},
{'names': ('-i', '--outgoing-agi-variable'), 'dest': 'outgoing_agi_var',
'type': 'string', 'action': 'store', 'default': "extension",
'help': "Enter the name of the AGI variable (without the 'agi_' "
"prefix) from which the script will get the phone number dialed by "
"the user on outgoing calls. For example, with Xivo, you should "
"specify 'dnid' as the AGI variable. Default = 'extension'"},
{'names': ('-m', '--max-size'), 'dest': 'max_size', 'type': 'int',
'action': 'store', 'default': 40,
'help': "If the name has more characters this maximum size, cut it "
"to this maximum size. Default = 40"},
]
@ -218,7 +264,8 @@ def main(options, arguments):
stdinput.get('agi_calleridname')
and not stdinput.get('agi_calleridname').isdigit()
and stdinput.get('agi_calleridname').lower()
not in ['asterisk', 'unknown', 'anonymous']):
not in ['asterisk', 'unknown', 'anonymous']
and not options.notify):
stdout_write(
'VERBOSE "Incoming CallerID name is %s"\n'
% stdinput.get('agi_calleridname'))

4
asterisk_click2dial/static/src/css/asterisk_click2dial.css

@ -4,13 +4,13 @@
The licence is in the file __openerp__.py
*/
.openerp .oe_topbar_item.oe_topbar_open_calling_partner{
.openerp .oe_topbar_item.oe_topbar_open_caller{
padding: 0px;
width: 32px;
height: 32px;
}
.openerp .oe_topbar_item.oe_topbar_open_calling_partner button{
.openerp .oe_topbar_item.oe_topbar_open_caller button{
position: relative;
top: -3px;
box-sizing: border-box;

58
asterisk_click2dial/static/src/js/asterisk_click2dial.js

@ -6,26 +6,54 @@ openerp.asterisk_click2dial = function (instance) {
var _t = instance.web._t;
instance.web.OpenCallingPartner = instance.web.Widget.extend({
template:'asterisk_click2dial.OpenCallingPartner',
instance.web.OpenCaller = instance.web.Widget.extend({
template:'asterisk_click2dial.OpenCaller',
start: function () {
this.$('button').on('click', this.on_open_calling_partner);
this.$('button').on('click', this.on_open_caller);
this._super();
},
on_open_calling_partner: function (event) {
on_open_caller: function (event) {
event.stopPropagation();
var action = {
name: _t('Open Calling Partner'),
type: 'ir.actions.act_window',
res_model: 'wizard.open.calling.partner',
view_mode: 'form',
views: [[false, 'form']],
target: 'new',
context: {},
};
instance.client.action_manager.do_action(action);
var self = this;
self.rpc('/asterisk_click2dial/get_record_from_my_channel', {}).done(function(r) {
// console.log('RESULT RPC r='+r);
// console.log('RESULT RPC type r='+typeof r);
if (r === false) {
self.do_notify(
_t('Failure'),
_t('Problem in the connection to Asterisk'));
}
else if (typeof r == 'string') {
var action = {
name: _t('Number Not Found'),
type: 'ir.actions.act_window',
res_model: 'number.not.found',
view_mode: 'form',
views: [[false, 'form']],
target: 'new',
context: {'default_calling_number': r},
};
instance.client.action_manager.do_action(action);
}
else if (typeof r == 'object' && r.length == 3) {
self.do_notify( // Not working
_t('Success'),
_t('Moving to %s ID %d', r[0], r[1]));
var action = {
type: 'ir.actions.act_window',
res_model: r[0],
res_id: r[1],
view_mode: 'form,tree',
views: [[false, 'form']],
target: 'current',
context: {},
};
instance.client.action_manager.do_action(action);
}
});
},
});
@ -33,7 +61,7 @@ openerp.asterisk_click2dial = function (instance) {
do_update: function(){
this._super.apply(this, arguments);
this.update_promise.then(function() {
var asterisk_button = new instance.web.OpenCallingPartner();
var asterisk_button = new instance.web.OpenCaller();
asterisk_button.appendTo(instance.webclient.$el.find('.oe_systray'));
});
},

8
asterisk_click2dial/static/src/xml/asterisk_click2dial.xml

@ -7,10 +7,10 @@
<template>
<!-- Add phone button in top right menu for "Open Calling Partner" -->
<t t-name="asterisk_click2dial.OpenCallingPartner">
<div title="Open Calling Partner"
class="oe_topbar_item oe_topbar_open_calling_partner">
<!-- Add phone button in top right menu for "Open Caller" -->
<t t-name="asterisk_click2dial.OpenCaller">
<div title="Open Caller"
class="oe_topbar_item oe_topbar_open_caller">
<button class="oe_i">A</button>
<!-- oe_i is a special icon font : 'A' represents a phone -->
</div>

22
asterisk_click2dial/wizard/__init__.py

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Asterisk Click2Dial module for OpenERP
# Copyright (C) 2012-2014 Alexis de Lattre <alexis@via.ecp.fr>
#
# 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 . import open_calling_partner

223
asterisk_click2dial/wizard/open_calling_partner.py

@ -1,223 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk Click2dial module for OpenERP
# Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr>
#
# 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, fields
from openerp.tools.translate import _
import logging
_logger = logging.getLogger(__name__)
class wizard_open_calling_partner(orm.TransientModel):
_name = "wizard.open.calling.partner"
_description = "Open calling partner"
_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_id': fields.many2one('res.partner', 'Partner name', help="Partner related to the calling number."),
'parent_partner_id': fields.many2one('res.partner', 'Parent partner', help="Parent Partner related to the calling number."),
'to_update_partner_id': fields.many2one('res.partner', 'Partner to update', help="Partner on which the phone or mobile number will be written"),
'current_phone': fields.related('to_update_partner_id', 'phone', type='char', relation='res.partner', string='Current phone'),
'current_mobile': fields.related('to_update_partner_id', 'mobile', type='char', relation='res.partner', string='Current mobile'),
}
def default_get(self, cr, uid, fields, context=None):
'''Thanks to the default_get method, we are able to query Asterisk and
get the corresponding partner when we launch the wizard'''
res = {}
if context is None:
context = {}
if 'incall_number_popup' in context:
# That's when we come from incall_notify_by_user_ids()
# of the module asterisk_popup()
res['partner_id'] = False
res['parent_partner_id'] = False
res['to_update_partner_id'] = False
res['calling_number'] = context.get('incall_number_popup')
else:
calling_number = self.pool['asterisk.server']._get_calling_number(
cr, uid, context=context)
#To test the code without Asterisk server
#calling_number = "0141981246"
if calling_number:
res['calling_number'] = calling_number
record = self.pool['phone.common'].get_record_from_phone_number(
cr, uid, calling_number, context=context)
if record and record[0] == 'res.partner':
res['partner_id'] = record[1]
partner = self.pool['res.partner'].browse(
cr, uid, record[1], context=context)
res['parent_partner_id'] = \
partner.parent_id and partner.parent_id.id or False
else:
res['partner_id'] = False
res['parent_partner_id'] = False
res['to_update_partner_id'] = False
else:
_logger.debug("Could not get the calling number from Asterisk.")
raise orm.except_orm(
_('Error :'),
_("Could not get the calling number from Asterisk. Is your phone ringing or are you currently on the phone ? If yes, check your setup and look at the OpenERP debug logs."))
return res
def open_filtered_object(
self, cr, uid, ids, oerp_object, try_parent=True, context=None):
'''Returns the action that opens the list view of the 'oerp_object'
given as argument filtered on the partner'''
# This module only depends on "base"
# and I don't want to add a dependancy on "sale" or "account"
# So I just check here that the model exists, to avoid a crash
if not self.pool['ir.model'].search(cr, uid, [('model', '=', oerp_object._name)], context=context):
raise orm.except_orm(_('Error :'), _("The object '%s' is not found in your OpenERP database, probably because the related module is not installed." % oerp_object._description))
partner = self.read(cr, uid, ids[0], ['partner_id', 'parent_partner_id'], context=context)
if try_parent:
partner_id_to_filter = (
partner['parent_partner_id']
and partner['parent_partner_id'][0]
or (partner['partner_id'] and partner['partner_id'][0] or False))
else:
partner_id_to_filter = partner['partner_id'] and partner['partner_id'][0] or False
if partner_id_to_filter:
action = {
'name': oerp_object._description,
'view_mode': 'tree,form,kanban',
'res_model': oerp_object._name,
'type': 'ir.actions.act_window',
'nodestroy': False, # close the pop-up wizard after action
'target': 'current',
'context': {'search_default_partner_id': partner_id_to_filter},
}
return action
else:
return False
def open_sale_orders(self, cr, uid, ids, context=None):
'''Function called by the related button of the wizard'''
return self.open_filtered_object(cr, uid, ids, self.pool.get('sale.order'), context=context)
def open_invoices(self, cr, uid, ids, context=None):
'''Function called by the related button of the wizard'''
return self.open_filtered_object(cr, uid, ids, self.pool.get('account.invoice'), context=context)
def simple_open(self, cr, uid, ids, field='partner_id', context=None):
record_to_open = self.read(cr, uid, ids[0], [field], context=context)[field]
if record_to_open:
return {
'name': self.pool['res.partner']._description,
'view_mode': 'form,tree,kanban',
'res_model': 'res.partner',
'type': 'ir.actions.act_window',
'nodestroy': False, # close the pop-up wizard after action
'target': 'current',
'res_id': record_to_open[0],
}
else:
return False
def open_partner(self, cr, uid, ids, context=None):
'''Function called by the related button of the wizard'''
return self.simple_open(cr, uid, ids, field='partner_id', context=context)
# TODO
def open_parent_partner(self, cr, uid, ids, context=None):
'''Function called by the related button of the wizard'''
return self.simple_open(cr, uid, ids, field='parent_partner_id', context=context)
def create_partner(self, cr, uid, ids, phone_type='phone', context=None):
'''Function called by the related button of the wizard'''
calling_number = self.read(cr, uid, ids[0], ['calling_number'], context=context)['calling_number']
ast_server = self.pool['asterisk.server']._get_asterisk_server_from_user(cr, uid, context=context)
# Convert the number to the international format
number_to_write = self.pool['asterisk.server']._convert_number_to_international_format(cr, uid, calling_number, ast_server, context=context)
context['default_' + phone_type] = number_to_write
action = {
'name': 'Create new partner',
'view_mode': 'form,tree,kanban',
'res_model': 'res.partner',
'type': 'ir.actions.act_window',
'nodestroy': False,
'target': 'current',
'context': context,
}
return action
def create_partner_phone(self, cr, uid, ids, context=None):
return self.create_partner(cr, uid, ids, phone_type='phone', context=context)
def create_partner_mobile(self, cr, uid, ids, context=None):
return self.create_partner(cr, uid, ids, phone_type='mobile', context=context)
def update_partner(self, cr, uid, ids, phone_type='mobile', context=None):
cur_wizard = self.browse(cr, uid, ids[0], context=context)
if not cur_wizard.to_update_partner_id:
raise orm.except_orm(_('Error :'), _("Select the partner to update."))
ast_server = self.pool['asterisk.server']._get_asterisk_server_from_user(cr, uid, context=context)
number_to_write = self.pool['asterisk.server']._convert_number_to_international_format(cr, uid, cur_wizard.calling_number, ast_server, context=context)
self.pool['res.partner'].write(cr, uid, cur_wizard.to_update_partner_id.id, {phone_type: number_to_write}, context=context)
action = {
'name': 'Partner: ' + cur_wizard.to_update_partner_id.name,
'view_mode': 'form,tree,kanban',
'res_model': 'res.partner',
'type': 'ir.actions.act_window',
'nodestroy': False,
'target': 'current',
'res_id': cur_wizard.to_update_partner_id.id
}
return action
def update_partner_phone(self, cr, uid, ids, context=None):
return self.update_partner(cr, uid, ids, phone_type='phone', context=context)
def update_partner_mobile(self, cr, uid, ids, context=None):
return self.update_partner(cr, uid, ids, phone_type='mobile', context=context)
def onchange_to_update_partner(self, cr, uid, ids, to_update_partner_id, context=None):
res = {}
res['value'] = {}
if to_update_partner_id:
to_update_partner = self.pool['res.partner'].browse(cr, uid, to_update_partner_id, context=context)
res['value'].update({'current_phone': to_update_partner.phone,
'current_mobile': to_update_partner.mobile})
else:
res['value'].update({'current_phone': False, 'current_mobile': False})
return res

51
asterisk_click2dial/wizard/open_calling_partner_view.xml

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2012-2013 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<!-- Get partner from incoming phone call -->
<record id="view_open_calling_partner" model="ir.ui.view">
<field name="name">view_open_calling_partner</field>
<field name="model">wizard.open.calling.partner</field>
<field name="arch" type="xml">
<form string="Open calling partner" version="7.0">
<group name="display_result">
<field name="calling_number"/>
<field name="partner_id" attrs="{'invisible':[('partner_id','=',False)]}"/>
<field name="parent_partner_id" attrs="{'invisible':[('partner_id','=',False)]}" /> <!-- I want it visible when partner_id != False and partner_id = False, so that the user can see that this partner doesn't have a parent partner -->
</group>
<group attrs="{'invisible':[('partner_id','=',False)]}" name="partner_found">
<button name="open_partner" icon="gtk-go-forward" string="Open Partner form" type="object" />
<button name="open_parent_partner" icon="gtk-go-forward" string="Open Parent Partner form" type="object" attrs="{'invisible':[('parent_partner_id','=',False)]}"/>
<button name="open_sale_orders" icon="gtk-go-forward" string="Open Related Sale Orders" type="object" />
<button name="open_invoices" icon="gtk-go-forward" string="Open Related Invoices" type="object" />
</group>
<group attrs="{'invisible':[('partner_id','!=',False)]}" name="no_partner_found" colspan="4" col="8">
<label string="No partner found in OpenERP with this number" colspan="8" />
<separator string="Create a new partner" colspan="8" />
<button name="create_partner_phone" icon="gtk-new" string="with calling number as phone" type="object" colspan="4"/>
<button name="create_partner_mobile" icon="gtk-new" string="with calling number as mobile" type="object" colspan="4"/>
<newline />
<separator string="Update an existing partner" colspan="8" />
<field name="to_update_partner_id" colspan="8" on_change="onchange_to_update_partner(to_update_partner_id)"/>
<field name="current_phone" colspan="6"/>
<button name="update_partner_phone" icon="gtk-convert" string="Update phone" type="object" colspan="2"/>
<field name="current_mobile" colspan="6"/>
<button name="update_partner_mobile" icon="gtk-convert" string="Update mobile" type="object" colspan="2"/>
</group>
<footer>
<button special="cancel" string="Cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>
</data>
</openerp>

1
asterisk_click2dial_crm/__openerp__.py

@ -49,7 +49,6 @@ A detailed documentation for the OpenERP-Asterisk connector is available on the
],
"demo": [],
"data": [
'wizard/open_calling_partner_view.xml',
'wizard/create_crm_phonecall_view.xml',
'res_users_view.xml',
],

11
asterisk_click2dial_crm/asterisk_click2dial_crm.py

@ -41,12 +41,11 @@ class phone_common(orm.AbstractModel):
if (
context.get('click2dial_model') == 'res.partner'
and user.context_propose_creation_crm_call):
return {
'name': _('Create Call in CRM'),
'res_model': 'wizard.create.crm.phonecall',
}
else:
return res
res.update({
'action_name': _('Create Call in CRM'),
'action_model': 'wizard.create.crm.phonecall',
})
return res
class res_users(orm.Model):

7
asterisk_click2dial_crm/i18n/asterisk_click2dial_crm.pot

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-21 16:23+0000\n"
"PO-Revision-Date: 2014-08-21 16:23+0000\n"
"POT-Creation-Date: 2014-08-25 22:02+0000\n"
"PO-Revision-Date: 2014-08-25 22:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -26,8 +26,7 @@ msgid "Create CRM phonecall"
msgstr ""
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:45
#: view:wizard.open.calling.partner:0
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:46
#, python-format
msgid "Create Call in CRM"
msgstr ""

7
asterisk_click2dial_crm/i18n/fr.po

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-21 16:24+0000\n"
"PO-Revision-Date: 2014-08-21 16:24+0000\n"
"POT-Creation-Date: 2014-08-25 22:02+0000\n"
"PO-Revision-Date: 2014-08-25 22:02+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -26,8 +26,7 @@ msgid "Create CRM phonecall"
msgstr "Créer un appel dans la CRM"
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:45
#: view:wizard.open.calling.partner:0
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:46
#, python-format
msgid "Create Call in CRM"
msgstr "Créer Appel dans CRM"

12
asterisk_click2dial_crm/wizard/create_crm_phonecall.py

@ -59,15 +59,3 @@ class wizard_create_crm_phonecall(orm.TransientModel):
'target': 'current',
'context': context,
}
class wizard_open_calling_partner(orm.TransientModel):
_inherit = "wizard.open.calling.partner"
def create_incoming_phonecall(self, cr, uid, ids, crm_categ, context=None):
'''Started by button on 'open calling partner wizard'''
partner = self.browse(cr, uid, ids[0], context=context).partner_id
action = self.pool['wizard.create.crm.phonecall'].\
_create_open_crm_phonecall(
cr, uid, partner, crm_categ='Inbound', context=context)
return action

24
asterisk_click2dial_crm/wizard/open_calling_partner_view.xml

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012-2013 Akretion (http://www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<!-- Add button on the "Get partner from incoming phone call view" -->
<record id="asterisk_click2dial_crm_open_calling_partner_view" model="ir.ui.view">
<field name="name">asterisk_click2dial_crm.open_calling_partner.view</field>
<field name="model">wizard.open.calling.partner</field>
<field name="inherit_id" ref="asterisk_click2dial.view_open_calling_partner"/>
<field name="arch" type="xml">
<group name="partner_found" position="inside">
<button name="create_incoming_phonecall" string="Create Call in CRM" type="object" icon="gtk-new" />
</group>
</field>
</record>
</data>
</openerp>

46
asterisk_click2dial_crm_claim/__openerp__.py

@ -1,46 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk click2dial CRM Claim module for OpenERP
# Copyright (c) 2012-2013 Akretion (http://www.akretion.com)
# Copyright (C) 2013 Invitu <contact@invitu.com>
# @author Alexis de Lattre <alexis.delattre@akretion.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/>.
#
##############################################################################
{
"name": "Asterisk Click2dial CRM Claim",
"version": "0.1",
"author": "Akretion",
"website": "http://www.akretion.com",
"license" : "AGPL-3",
"category": "Phone",
"description": """
This module adds a button "Open Related CRM Claims" on the "Open calling partner" wizard and a "Dial" button on the CRM Claim form.
A detailed documentation for the OpenERP-Asterisk connector is available on the Akretion Web site : http://www.akretion.com/open-source-contributions/openerp-asterisk-voip-connector
""",
"depends": [
'asterisk_click2dial',
'crm_claim_phone',
],
"demo": [],
"data": [
'wizard/open_calling_partner_view.xml',
],
"installable": True,
"application": True,
}

23
asterisk_click2dial_crm_claim/wizard/__init__.py

@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Asterisk Click2Dial CRM Claim module for OpenERP
# Copyright (C) 2012-2013 Akretion (http://www.akretion.com/)
# @author Alexis de Lattre <alexis.delattre@akretion.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 . import open_calling_partner

32
asterisk_click2dial_crm_claim/wizard/open_calling_partner.py

@ -1,32 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk Click2dial CRM Claim module for OpenERP
# Copyright (C) 2012-2014 Akretion (http://www.akretion.com/)
# @author Alexis de Lattre <alexis.delattre@akretion.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 wizard_open_calling_partner(orm.TransientModel):
_inherit = "wizard.open.calling.partner"
def open_crm_claims(self, cr, uid, ids, context=None):
'''Function called by the related button of the wizard'''
return self.open_filtered_object(
cr, uid, ids, self.pool['crm.claim'], context=context)

24
asterisk_click2dial_crm_claim/wizard/open_calling_partner_view.xml

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012-2013 Akretion (http://www.akretion.com)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<!-- Add button on the "Open Calling partner" wizard -->
<record id="add_open_crm_claims_button" model="ir.ui.view">
<field name="name">asterisk_click2dial_crm_claim.add_open_crm_claims_button</field>
<field name="model">wizard.open.calling.partner</field>
<field name="inherit_id" ref="asterisk_click2dial.view_open_calling_partner"/>
<field name="arch" type="xml">
<group name="partner_found" position="inside">
<button name="open_crm_claims" string="Open Related CRM Claims" type="object" icon="gtk-go-forward" />
</group>
</field>
</record>
</data>
</openerp>

43
asterisk_click2dial_event/__openerp__.py

@ -1,43 +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/>.
#
##############################################################################
{
"name": "Asterisk Click2dial Registration",
"version": "0.1",
"author": "INVITU",
"website": "http://www.invitu.com",
"license": "AGPL-3",
"category": "Phone",
"description": """
This module adds a button "Open Registrations" on the "Open calling partner" wizard and a "Dial" button on the Registration form.
A detailed documentation for the OpenERP-Asterisk connector is available on the Akretion Web site : http://www.akretion.com/open-source-contributions/openerp-asterisk-voip-connector
""",
"depends": [
'asterisk_click2dial',
'event_phone',
],
"data": [
'wizard/open_calling_partner_view.xml',
],
"installable": True,
"application": True,
}

22
asterisk_click2dial_event/wizard/__init__.py

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Asterisk Click2Dial Registration module for OpenERP
# Copyright (C) 2013 Invitu (http://www.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 . import open_calling_partner

31
asterisk_click2dial_event/wizard/open_calling_partner.py

@ -1,31 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk Click2dial Registration module for OpenERP
# Copyright (C) 2013 Invitu (http://www.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 wizard_open_calling_partner(orm.TransientModel):
_inherit = "wizard.open.calling.partner"
def open_registrations(self, cr, uid, ids, context=None):
'''Function called by the related button of the wizard'''
return self.open_filtered_object(
cr, uid, ids, self.pool['event.registration'], context=context)

23
asterisk_click2dial_event/wizard/open_calling_partner_view.xml

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 Invitu (http://www.invitu.com)
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<!-- Add button on the "Open Calling partner" wizard -->
<record id="add_open_registrations_button" model="ir.ui.view">
<field name="name">asterisk_click2dial_registration.add_open_registrations_button</field>
<field name="model">wizard.open.calling.partner</field>
<field name="inherit_id" ref="asterisk_click2dial.view_open_calling_partner"/>
<field name="arch" type="xml">
<group name="partner_found" position="inside">
<button name="open_registrations" string="Open Related Registrations" type="object" icon="gtk-go-forward" />
</group>
</field>
</record>
</data>
</openerp>

1
base_phone/__openerp__.py

@ -59,6 +59,7 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
'res_company_view.xml',
'res_users_view.xml',
'wizard/reformat_all_phonenumbers_view.xml',
'wizard/number_not_found_view.xml',
],
'js': [
'static/src/js/*.js',

7
base_phone/base_phone.py

@ -80,7 +80,7 @@ class phone_common(orm.AbstractModel):
# exception when you try to enter a phone number in
# national format... so it's better to raise the exception here
raise orm.except_orm(
_('Error :'),
_('Error:'),
_("You should set a country on the company '%s'")
% user.company_id.name)
for field in phonefields:
@ -91,7 +91,7 @@ class phone_common(orm.AbstractModel):
vals.get(field), user_countrycode)
except Exception, e:
raise orm.except_orm(
_('Error :'),
_('Error:'),
_("Cannot reformat the phone number '%s' to "
"international format. Error message: %s")
% (vals.get(field), e))
@ -177,7 +177,6 @@ class phone_common(orm.AbstractModel):
name = obj.name_get(
cr, uid, res_ids[0], context=ctx_phone)[0][1]
res = (objname, res_ids[0], name)
print "res=", res
_logger.debug(
u"Answer get_record_from_phone_number: (%s, %d, %s)"
% (res[0], res[1], res[2]))
@ -203,7 +202,7 @@ class phone_common(orm.AbstractModel):
def click2dial(self, cr, uid, erp_number, context=None):
'''This function is designed to be overridden in IPBX-specific
modules, such as asterisk_click2dial'''
return True
return {'dialed_number': erp_number}
class res_partner(orm.Model):

115
base_phone/i18n/base_phone.pot

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-21 16:15+0000\n"
"PO-Revision-Date: 2014-08-21 16:15+0000\n"
"POT-Creation-Date: 2014-08-25 21:28+0000\n"
"PO-Revision-Date: 2014-08-25 21:28+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -28,30 +28,71 @@ msgstr ""
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:30
#: code:addons/base_phone/static/src/js/phone_widget.js:34
#, python-format
msgid "Click2dial started"
msgstr ""
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:40
#: code:addons/base_phone/static/src/js/phone_widget.js:46
#, python-format
msgid "Click2dial successfull"
msgstr ""
#. module: base_phone
#: view:number.not.found:0
msgid "Close"
msgstr ""
#. module: base_phone
#: model:ir.model,name:base_phone.model_res_company
msgid "Companies"
msgstr ""
#. module: base_phone
#: code:addons/base_phone/wizard/number_not_found.py:85
#, python-format
msgid "Create New Partner"
msgstr ""
#. module: base_phone
#: view:number.not.found:0
msgid "Create Partner with this Number"
msgstr ""
#. module: base_phone
#: view:number.not.found:0
msgid "Create or Update a Partner"
msgstr ""
#. module: base_phone
#: field:number.not.found,current_partner_mobile:0
msgid "Current Mobile"
msgstr ""
#. module: base_phone
#: field:number.not.found,current_partner_phone:0
msgid "Current Phone"
msgstr ""
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:27
#: code:addons/base_phone/static/src/js/phone_widget.js:31
#, python-format
msgid "Dial"
msgstr ""
#. module: base_phone
#: field:number.not.found,e164_number:0
msgid "E.164 Number"
msgstr ""
#. module: base_phone
#: help:number.not.found,e164_number:0
msgid "E.164 equivalent of the calling number."
msgstr ""
#. module: base_phone
#: view:res.users:0
msgid "Email Preferences"
@ -60,8 +101,19 @@ msgstr ""
#. module: base_phone
#: code:addons/base_phone/base_phone.py:83
#: code:addons/base_phone/base_phone.py:94
#: code:addons/base_phone/wizard/number_not_found.py:99
#, python-format
msgid "Error :"
msgid "Error:"
msgstr ""
#. module: base_phone
#: selection:number.not.found,number_type:0
msgid "Fixed"
msgstr ""
#. module: base_phone
#: field:number.not.found,number_type:0
msgid "Fixed/Mobile"
msgstr ""
#. module: base_phone
@ -69,6 +121,38 @@ msgstr ""
msgid "In several situations, OpenERP will have to find a Partner/Lead/Employee/... from a phone number presented by the calling party. As the phone numbers presented by your phone operator may not always be displayed in a standard format, the best method to find the related Partner/Lead/Employee/... in OpenERP is to try to match the end of the phone number in OpenERP with the N last digits of the phone number presented by the calling party. N is the value you should enter in this field."
msgstr ""
#. module: base_phone
#: selection:number.not.found,number_type:0
msgid "Mobile"
msgstr ""
#. module: base_phone
#: view:number.not.found:0
msgid "Number Not Found"
msgstr ""
#. module: base_phone
#: view:number.not.found:0
msgid "Number converted to international format:"
msgstr ""
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:47
#, python-format
msgid "Number dialed:"
msgstr ""
#. module: base_phone
#: model:ir.model,name:base_phone.model_number_not_found
msgid "Number not found"
msgstr ""
#. module: base_phone
#: view:number.not.found:0
msgid "Number not found:"
msgstr ""
#. module: base_phone
#: field:res.company,number_of_digits_to_match_from_end:0
msgid "Number of Digits To Match From End"
@ -79,6 +163,12 @@ msgstr ""
msgid "Partner"
msgstr ""
#. module: base_phone
#: code:addons/base_phone/wizard/number_not_found.py:105
#, python-format
msgid "Partner: %s"
msgstr ""
#. module: base_phone
#: view:res.company:0
msgid "Phone"
@ -111,6 +201,12 @@ msgstr ""
msgid "Reformat all phone numbers"
msgstr ""
#. module: base_phone
#: code:addons/base_phone/wizard/number_not_found.py:100
#, python-format
msgid "Select the Partner to Update."
msgstr ""
#. module: base_phone
#: model:ir.ui.menu,name:base_phone.menu_config_phone
#: view:res.users:0
@ -134,11 +230,16 @@ msgstr ""
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:31
#: code:addons/base_phone/static/src/js/phone_widget.js:35
#, python-format
msgid "Unhook your ringing phone"
msgstr ""
#. module: base_phone
#: view:number.not.found:0
msgid "Update Partner with this Number"
msgstr ""
#. module: base_phone
#: constraint:res.partner:0
msgid "You cannot create recursive Partner hierarchies."

121
base_phone/i18n/fr.po

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-21 16:16+0000\n"
"PO-Revision-Date: 2014-08-21 16:16+0000\n"
"POT-Creation-Date: 2014-08-25 21:29+0000\n"
"PO-Revision-Date: 2014-08-25 21:29+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -18,40 +18,81 @@ msgstr ""
#. module: base_phone
#: view:reformat.all.phonenumbers:0
msgid "Cancel"
msgstr "Cancel"
msgstr "Annuler"
#. module: base_phone
#: code:addons/base_phone/base_phone.py:95
#, python-format
msgid "Cannot reformat the phone number '%s' to international format. Error message: %s"
msgstr "Cannot reformat the phone number '%s' to international format. Error message: %s"
msgstr "Impossible de reformatter le numéro de téléphone '%s' au format international. Message d'erreur : %s"
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:30
#: code:addons/base_phone/static/src/js/phone_widget.js:34
#, python-format
msgid "Click2dial started"
msgstr "Début du Click2dial"
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:40
#: code:addons/base_phone/static/src/js/phone_widget.js:46
#, python-format
msgid "Click2dial successfull"
msgstr "Click2dial réussi"
#. module: base_phone
#: view:number.not.found:0
msgid "Close"
msgstr "Fermer"
#. module: base_phone
#: model:ir.model,name:base_phone.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: base_phone
#: code:addons/base_phone/wizard/number_not_found.py:85
#, python-format
msgid "Create New Partner"
msgstr "Créer un nouveau partenaire"
#. module: base_phone
#: view:number.not.found:0
msgid "Create Partner with this Number"
msgstr "Créer un partenaire avec ce numéro"
#. module: base_phone
#: view:number.not.found:0
msgid "Create or Update a Partner"
msgstr "Créer ou mettre à jour un partenaire"
#. module: base_phone
#: field:number.not.found,current_partner_mobile:0
msgid "Current Mobile"
msgstr "Portable actuel"
#. module: base_phone
#: field:number.not.found,current_partner_phone:0
msgid "Current Phone"
msgstr "Téléphone actuel"
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:27
#: code:addons/base_phone/static/src/js/phone_widget.js:31
#, python-format
msgid "Dial"
msgstr "Composer"
#. module: base_phone
#: field:number.not.found,e164_number:0
msgid "E.164 Number"
msgstr "Numéro E.164"
#. module: base_phone
#: help:number.not.found,e164_number:0
msgid "E.164 equivalent of the calling number."
msgstr "Equivalent au format E.164 du numéro appelant."
#. module: base_phone
#: view:res.users:0
msgid "Email Preferences"
@ -60,25 +101,74 @@ msgstr "Préférences de messagerie électronique"
#. module: base_phone
#: code:addons/base_phone/base_phone.py:83
#: code:addons/base_phone/base_phone.py:94
#: code:addons/base_phone/wizard/number_not_found.py:99
#, python-format
msgid "Error :"
msgid "Error:"
msgstr "Erreur :"
#. module: base_phone
#: selection:number.not.found,number_type:0
msgid "Fixed"
msgstr "Fixe"
#. module: base_phone
#: field:number.not.found,number_type:0
msgid "Fixed/Mobile"
msgstr "Fixe/Portable"
#. module: base_phone
#: help:res.company,number_of_digits_to_match_from_end:0
msgid "In several situations, OpenERP will have to find a Partner/Lead/Employee/... from a phone number presented by the calling party. As the phone numbers presented by your phone operator may not always be displayed in a standard format, the best method to find the related Partner/Lead/Employee/... in OpenERP is to try to match the end of the phone number in OpenERP with the N last digits of the phone number presented by the calling party. N is the value you should enter in this field."
msgstr "In several situations, OpenERP will have to find a Partner/Lead/Employee/... from a phone number presented by the calling party. As the phone numbers presented by your phone operator may not always be displayed in a standard format, the best method to find the related Partner/Lead/Employee/... in OpenERP is to try to match the end of the phone number in OpenERP with the N last digits of the phone number presented by the calling party. N is the value you should enter in this field."
#. module: base_phone
#: selection:number.not.found,number_type:0
msgid "Mobile"
msgstr "Portable"
#. module: base_phone
#: view:number.not.found:0
msgid "Number Not Found"
msgstr "Numéro introuvable"
#. module: base_phone
#: view:number.not.found:0
msgid "Number converted to international format:"
msgstr "Numéro converti au format international :"
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:47
#, python-format
msgid "Number dialed:"
msgstr "Numéro composé :"
#. module: base_phone
#: model:ir.model,name:base_phone.model_number_not_found
msgid "Number not found"
msgstr "Numéro introuvable"
#. module: base_phone
#: view:number.not.found:0
msgid "Number not found:"
msgstr "Numéro introuvable :"
#. module: base_phone
#: field:res.company,number_of_digits_to_match_from_end:0
msgid "Number of Digits To Match From End"
msgstr "Number of Digits To Match From End"
msgstr "Nombre de chiffres à faire correspondre en partant de la fin"
#. module: base_phone
#: model:ir.model,name:base_phone.model_res_partner
msgid "Partner"
msgstr "Partenaire"
#. module: base_phone
#: code:addons/base_phone/wizard/number_not_found.py:105
#, python-format
msgid "Partner: %s"
msgstr "Partenaire : %s"
#. module: base_phone
#: view:res.company:0
msgid "Phone"
@ -111,6 +201,12 @@ msgstr "Reformate les numéros de téléphone"
msgid "Reformat all phone numbers"
msgstr "Reformate tous les numéros de téléphone"
#. module: base_phone
#: code:addons/base_phone/wizard/number_not_found.py:100
#, python-format
msgid "Select the Partner to Update."
msgstr "Selectionnez le partenaire à mettre à jour."
#. module: base_phone
#: model:ir.ui.menu,name:base_phone.menu_config_phone
#: view:res.users:0
@ -134,11 +230,16 @@ msgstr "Cet assistant reformate le numéro de téléphone fixe, portable et le f
#. module: base_phone
#. openerp-web
#: code:addons/base_phone/static/src/js/phone_widget.js:31
#: code:addons/base_phone/static/src/js/phone_widget.js:35
#, python-format
msgid "Unhook your ringing phone"
msgstr "Décrochez votre téléphone"
#. module: base_phone
#: view:number.not.found:0
msgid "Update Partner with this Number"
msgstr "Mettre à jour le partenaire avec ce numéro"
#. module: base_phone
#: constraint:res.partner:0
msgid "You cannot create recursive Partner hierarchies."

88
base_phone/static/src/js/phone_widget.js

@ -20,44 +20,52 @@ openerp.base_phone = function (instance) {
} else {
var self = this;
var phone_num = this.get('value');
this.$el.find('a.oe_form_uri')
.attr('href', 'tel:' + phone_num)
.text(phone_num && formatInternational('', phone_num) || '');
this.$el.find('#click2dial')
.text(phone_num && _t('Dial') || '')
.on('click', function(ev) {
self.do_notify(
_t('Click2dial started'),
_t('Unhook your ringing phone'));
var arg = {
'phone_number': phone_num,
'click2dial_model': self.view.dataset.model,
'click2dial_id': self.view.datarecord.id};
self.rpc('/base_phone/click2dial', arg).done(function(r) {
if (r === false) {
self.do_warn("Click2dial failed");
} else {
self.do_notify(_t('Click2dial successfull'), '');
if (typeof r === 'object') {
var context = {};
if (self.view.dataset.model == 'res.partner') {
context = {
'partner_id': self.view.datarecord.id};
}
var action = {
name: r.name,
type: 'ir.actions.act_window',
res_model: r.res_model,
view_mode: 'form',
views: [[false, 'form']],
target: 'new',
context: context,
};
instance.client.action_manager.do_action(action);
//console.log('BASE_PHONE phone_num = %s', phone_num);
if (phone_num) {
this.$el.find('a.oe_form_uri')
.attr('href', 'tel:' + phone_num)
.text(formatInternational('', phone_num) || '');
}
if (phone_num && !this.options.dial_button_invisible) {
this.$el.find('#click2dial')
.text(phone_num && _t('Dial') || '')
.on('click', function(ev) {
self.do_notify(
_t('Click2dial started'),
_t('Unhook your ringing phone'));
var arg = {
'phone_number': phone_num,
'click2dial_model': self.view.dataset.model,
'click2dial_id': self.view.datarecord.id};
self.rpc('/base_phone/click2dial', arg).done(function(r) {
//console.log('Click2dial r=%s', JSON.stringify(r));
if (r === false) {
self.do_warn("Click2dial failed");
} else if (typeof r === 'object') {
self.do_notify(
_t('Click2dial successfull'),
_t('Number dialed:') + ' ' + r.dialed_number);
if (r.action_model) {
var context = {};
if (self.view.dataset.model == 'res.partner') {
context = {
'partner_id': self.view.datarecord.id};
}
var action = {
name: r.action_name,
type: 'ir.actions.act_window',
res_model: r.action_model,
view_mode: 'form',
views: [[false, 'form']],
target: 'new',
context: context,
};
instance.client.action_manager.do_action(action);
}
}
}
});
});
});
}
}
},
on_button_clicked: function() {
@ -80,9 +88,11 @@ openerp.base_phone = function (instance) {
this._super();
} else {
var fax_num = this.get('value');
this.$el.find('a.oe_form_uri')
.attr('href', 'fax:' + fax_num)
.text(fax_num && formatInternational('', fax_num) || '');
if (fax_num) {
this.$el.find('a.oe_form_uri')
.attr('href', 'fax:' + fax_num)
.text(formatInternational('', fax_num) || '');
}
}
},
on_button_clicked: function() {

1
base_phone/wizard/__init__.py

@ -20,3 +20,4 @@
##############################################################################
from . import reformat_all_phonenumbers
from . import number_not_found

130
base_phone/wizard/number_not_found.py

@ -0,0 +1,130 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk Click2dial module for OpenERP
# Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr>
#
# 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, fields
from openerp.tools.translate import _
import logging
import phonenumbers
_logger = logging.getLogger(__name__)
class number_not_found(orm.TransientModel):
_name = "number.not.found"
_description = "Number not found"
_columns = {
'calling_number': fields.char(
'Calling Number', size=64, readonly=True,
help="Phone number of calling party that has been obtained "
"from Asterisk, in the format used by Asterisk (not E.164)."),
'e164_number': fields.char(
'E.164 Number', size=64,
help="E.164 equivalent of the calling number."),
'number_type': fields.selection(
[('phone', 'Fixed'), ('mobile', 'Mobile')],
'Fixed/Mobile', required=True),
'to_update_partner_id': fields.many2one(
'res.partner', 'Partner to Update',
help="Partner on which the phone number will be written"),
'current_partner_phone': fields.related(
'to_update_partner_id', 'phone', type='char',
relation='res.partner', string='Current Phone', readonly=True),
'current_partner_mobile': fields.related(
'to_update_partner_id', 'mobile', type='char',
relation='res.partner', string='Current Mobile', readonly=True),
}
def default_get(self, cr, uid, fields_list, context=None):
res = super(number_not_found, self).default_get(
cr, uid, fields_list, context=context)
if not res:
res = {}
if res.get('calling_number'):
convert = self.pool['phone.common']._generic_reformat_phonenumbers(
cr, uid, {'phone': res.get('calling_number')}, context=context)
parsed_num = phonenumbers.parse(convert.get('phone'))
res['e164_number'] = phonenumbers.format_number(
parsed_num, phonenumbers.PhoneNumberFormat.INTERNATIONAL)
number_type = phonenumbers.number_type(parsed_num)
if number_type == 1:
res['number_type'] = 'mobile'
else:
res['number_type'] = 'phone'
return res
def create_partner(self, cr, uid, ids, context=None):
'''Function called by the related button of the wizard'''
if context is None:
context = {}
wiz = self.browse(cr, uid, ids[0], context=context)
parsed_num = phonenumbers.parse(wiz.e164_number, None)
number_type = phonenumbers.number_type(parsed_num)
context['default_%s' % wiz.number_type] = wiz.e164_number
action = {
'name': _('Create New Partner'),
'view_mode': 'form,tree,kanban',
'res_model': 'res.partner',
'type': 'ir.actions.act_window',
'nodestroy': False,
'target': 'current',
'context': context,
}
return action
def update_partner(self, cr, uid, ids, context=None):
wiz = self.browse(cr, uid, ids[0], context=context)
if not wiz.to_update_partner_id:
raise orm.except_orm(
_('Error:'),
_("Select the Partner to Update."))
self.pool['res.partner'].write(
cr, uid, wiz.to_update_partner_id.id,
{wiz.number_type: wiz.e164_number}, context=context)
action = {
'name': _('Partner: %s' % wiz.to_update_partner_id.name),
'type': 'ir.actions.act_window',
'res_model': 'res.partner',
'view_mode': 'form,tree,kanban',
'nodestroy': False,
'target': 'current',
'res_id': wiz.to_update_partner_id.id,
'context': context,
}
return action
def onchange_to_update_partner(
self, cr, uid, ids, to_update_partner_id, context=None):
res = {'value': {}}
if to_update_partner_id:
to_update_partner = self.pool['res.partner'].browse(
cr, uid, to_update_partner_id, context=context)
res['value'].update({
'current_partner_phone': to_update_partner.phone,
'current_partner_mobile': to_update_partner.mobile,
})
else:
res['value'].update({
'current_partner_phone': False,
'current_partner_mobile': False,
})
return res

55
base_phone/wizard/number_not_found_view.xml

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2012-2013 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="number_not_found_form" model="ir.ui.view">
<field name="name">number.not.found.form</field>
<field name="model">number.not.found</field>
<field name="arch" type="xml">
<form string="Number Not Found" version="7.0">
<div class="oe_title">
<label string="Number not found:" for="calling_number"/>
<h1>
<field name="calling_number" />
</h1>
<label string="Number converted to international format:"
for="e164_number"/>
<h2>
<field name="e164_number" />
</h2>
<label for="number_type"/>
<h3>
<field name="number_type"/>
</h3>
</div>
<group colspan="4" col="2" name="create-update">
<group name="partner" string="Create or Update a Partner"
colspan="1" col="2">
<button name="create_partner" icon="gtk-new" colspan="2"
string="Create Partner with this Number" type="object"/>
<field name="to_update_partner_id"
on_change="onchange_to_update_partner(to_update_partner_id)"/>
<field name="current_partner_phone" widget="phone"
options="{'dial_button_invisible': True}"/>
<field name="current_partner_mobile" widget="phone"
options="{'dial_button_invisible': True}"/>
<button name="update_partner" icon="gtk-convert" colspan="2"
string="Update Partner with this Number" type="object"/>
</group>
</group>
<footer>
<button special="cancel" string="Close" class="oe_link"/>
</footer>
</form>
</field>
</record>
</data>
</openerp>

25
base_phone_popup/i18n/asterisk_popup.pot → base_phone_popup/i18n/base_phone_popup.pot

@ -1,13 +1,13 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * asterisk_popup
# * base_phone_popup
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-31 23:34+0000\n"
"PO-Revision-Date: 2014-01-31 23:34+0000\n"
"POT-Creation-Date: 2014-08-25 22:05+0000\n"
"PO-Revision-Date: 2014-08-25 22:05+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -15,23 +15,24 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: asterisk_popup
#: model:ir.model,name:asterisk_popup.model_res_partner
msgid "Partner"
#. module: base_phone_popup
#: code:addons/base_phone_popup/popup.py:49
#, python-format
msgid "Number Not Found"
msgstr ""
#. module: asterisk_popup
#. module: base_phone_popup
#: field:res.users,context_incall_popup:0
msgid "Pop-up on Incoming Calls"
msgstr ""
#. module: asterisk_popup
#: model:ir.model,name:asterisk_popup.model_res_users
#. module: base_phone_popup
#: model:ir.model,name:base_phone_popup.model_res_users
msgid "Users"
msgstr ""
#. module: asterisk_popup
#: view:res.users:0
msgid "Telephony Preferences"
#. module: base_phone_popup
#: model:ir.model,name:base_phone_popup.model_phone_common
msgid "phone.common"
msgstr ""

32
base_phone_popup/i18n/fr.po

@ -1,36 +1,38 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * asterisk_popup
# * base_phone_popup
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-31 23:35+0000\n"
"PO-Revision-Date: 2014-01-31 23:35+0000\n"
"Last-Translator: <>\n"
"POT-Creation-Date: 2014-08-25 22:05+0000\n"
"PO-Revision-Date: 2014-08-25 22:05+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: asterisk_popup
#: model:ir.model,name:asterisk_popup.model_res_partner
msgid "Partner"
msgstr "Partenaire"
#. module: base_phone_popup
#: code:addons/base_phone_popup/popup.py:49
#, python-format
msgid "Number Not Found"
msgstr "Numéro introuvable"
#. module: asterisk_popup
#. module: base_phone_popup
#: field:res.users,context_incall_popup:0
msgid "Pop-up on Incoming Calls"
msgstr "Pop-up sur Appel Entrant"
#. module: asterisk_popup
#: model:ir.model,name:asterisk_popup.model_res_users
#. module: base_phone_popup
#: model:ir.model,name:base_phone_popup.model_res_users
msgid "Users"
msgstr "Utilisateurs"
#. module: asterisk_popup
#: view:res.users:0
msgid "Telephony Preferences"
msgstr "Préférences téléphoniques"
#. module: base_phone_popup
#: model:ir.model,name:base_phone_popup.model_phone_common
msgid "phone.common"
msgstr "phone.common"

11
base_phone_popup/popup.py

@ -20,6 +20,7 @@
##############################################################################
from openerp.osv import orm, fields
from openerp.tools.translate import _
import logging
@ -43,6 +44,16 @@ class phone_common(orm.AbstractModel):
'target': 'new',
'res_id': record_res[1],
}
else:
action = {
'name': _('Number Not Found'),
'type': 'ir.actions.act_window',
'res_model': 'number.not.found',
'view_mode': 'form',
'views': [[False, 'form']], # Beurk, but needed
'target': 'new',
'context': {'default_calling_number': number}
}
return action
def incall_notify_by_login(

1
crm_phone/__init__.py

@ -20,3 +20,4 @@
##############################################################################
from . import crm_phone
from . import wizard

1
crm_phone/__openerp__.py

@ -42,6 +42,7 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
'data': [
'security/ir.model.access.csv',
'crm_view.xml',
'wizard/number_not_found_view.xml',
],
'images': [],
'installable': True,

112
crm_phone/i18n/crm_phone.pot

@ -0,0 +1,112 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * crm_phone
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-25 21:38+0000\n"
"PO-Revision-Date: 2014-08-25 21:38+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: crm_phone
#: view:number.not.found:0
msgid "Create Lead with this Number"
msgstr ""
#. module: crm_phone
#: code:addons/crm_phone/wizard/number_not_found.py:50
#, python-format
msgid "Create New Lead"
msgstr ""
#. module: crm_phone
#: view:number.not.found:0
msgid "Create or Update a Lead"
msgstr ""
#. module: crm_phone
#: field:number.not.found,current_lead_mobile:0
msgid "Current Mobile"
msgstr ""
#. module: crm_phone
#: field:number.not.found,current_lead_phone:0
msgid "Current Phone"
msgstr ""
#. module: crm_phone
#: code:addons/crm_phone/wizard/number_not_found.py:70
#, python-format
msgid "Error:"
msgstr ""
#. module: crm_phone
#: help:number.not.found,to_update_lead_id:0
msgid "Lead on which the phone number will be written"
msgstr ""
#. module: crm_phone
#: field:number.not.found,to_update_lead_id:0
msgid "Lead to Update"
msgstr ""
#. module: crm_phone
#: model:ir.model,name:crm_phone.model_crm_lead
msgid "Lead/Opportunity"
msgstr ""
#. module: crm_phone
#: code:addons/crm_phone/wizard/number_not_found.py:76
#, python-format
msgid "Lead: %s"
msgstr ""
#. module: crm_phone
#: model:ir.model,name:crm_phone.model_number_not_found
msgid "Number not found"
msgstr ""
#. module: crm_phone
#: model:ir.model,name:crm_phone.model_crm_phonecall
msgid "Phonecall"
msgstr ""
#. module: crm_phone
#: code:addons/crm_phone/wizard/number_not_found.py:71
#, python-format
msgid "Select the Lead to Update."
msgstr ""
#. module: crm_phone
#: sql_constraint:crm.lead:0
msgid "The probability of closing the deal should be between 0% and 100%!"
msgstr ""
#. module: crm_phone
#: view:number.not.found:0
msgid "Update Lead with this Number"
msgstr ""
#. module: crm_phone
#: view:crm.lead:0
msgid "fax"
msgstr ""
#. module: crm_phone
#: view:crm.lead:0
#: view:crm.phonecall:0
msgid "phone"
msgstr ""
#. module: crm_phone
#: model:ir.model,name:crm_phone.model_phone_common
msgid "phone.common"
msgstr ""

112
crm_phone/i18n/fr.po

@ -0,0 +1,112 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * crm_phone
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-25 21:39+0000\n"
"PO-Revision-Date: 2014-08-25 21:39+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: crm_phone
#: view:number.not.found:0
msgid "Create Lead with this Number"
msgstr "Créer une piste avec ce numéro"
#. module: crm_phone
#: code:addons/crm_phone/wizard/number_not_found.py:50
#, python-format
msgid "Create New Lead"
msgstr "Créer une nouvelle piste"
#. module: crm_phone
#: view:number.not.found:0
msgid "Create or Update a Lead"
msgstr "Créer ou mettre à jour une piste"
#. module: crm_phone
#: field:number.not.found,current_lead_mobile:0
msgid "Current Mobile"
msgstr "Portable actuel"
#. module: crm_phone
#: field:number.not.found,current_lead_phone:0
msgid "Current Phone"
msgstr "Téléphone actuel"
#. module: crm_phone
#: code:addons/crm_phone/wizard/number_not_found.py:70
#, python-format
msgid "Error:"
msgstr "Erreur :"
#. module: crm_phone
#: help:number.not.found,to_update_lead_id:0
msgid "Lead on which the phone number will be written"
msgstr "Piste sur laquelle le numéro de téléphone sera écrit"
#. module: crm_phone
#: field:number.not.found,to_update_lead_id:0
msgid "Lead to Update"
msgstr "Piste à mettre à jour"
#. module: crm_phone
#: model:ir.model,name:crm_phone.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Piste/opportunité"
#. module: crm_phone
#: code:addons/crm_phone/wizard/number_not_found.py:76
#, python-format
msgid "Lead: %s"
msgstr "Piste : %s"
#. module: crm_phone
#: model:ir.model,name:crm_phone.model_number_not_found
msgid "Number not found"
msgstr "Numéro introuvable"
#. module: crm_phone
#: model:ir.model,name:crm_phone.model_crm_phonecall
msgid "Phonecall"
msgstr "Appel téléphonique"
#. module: crm_phone
#: code:addons/crm_phone/wizard/number_not_found.py:71
#, python-format
msgid "Select the Lead to Update."
msgstr "Sélectionnez la piste à mettre à jour."
#. module: crm_phone
#: sql_constraint:crm.lead:0
msgid "The probability of closing the deal should be between 0% and 100%!"
msgstr "La probabilité de gagner l'affaire doit être comprise entre 0% et 100% !"
#. module: crm_phone
#: view:number.not.found:0
msgid "Update Lead with this Number"
msgstr "Mettre à jour la piste avec ce numéro"
#. module: crm_phone
#: view:crm.lead:0
msgid "fax"
msgstr "fax"
#. module: crm_phone
#: view:crm.lead:0
#: view:crm.phonecall:0
msgid "phone"
msgstr "phone"
#. module: crm_phone
#: model:ir.model,name:crm_phone.model_phone_common
msgid "phone.common"
msgstr "phone.common"

6
asterisk_click2dial_event/__init__.py → crm_phone/wizard/__init__.py

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Asterisk Click2Dial Registration module for OpenERP
# Copyright (C) 2013 Invitu (http://www.invitu.com/)
# CRM Phone module for OpenERP
# Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -19,4 +19,4 @@
#
##############################################################################
from . import wizard
from . import number_not_found

105
crm_phone/wizard/number_not_found.py

@ -0,0 +1,105 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Asterisk Click2dial module for OpenERP
# Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr>
#
# 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, fields
from openerp.tools.translate import _
import phonenumbers
class number_not_found(orm.TransientModel):
_inherit = "number.not.found"
_columns = {
'to_update_lead_id': fields.many2one(
'crm.lead', 'Lead to Update',
domain=[('type', '=', 'lead')],
help="Lead on which the phone number will be written"),
'current_lead_phone': fields.related(
'to_update_lead_id', 'phone', type='char',
relation='crm.lead', string='Current Phone', readonly=True),
'current_lead_mobile': fields.related(
'to_update_lead_id', 'mobile', type='char',
relation='crm.lead', string='Current Mobile', readonly=True),
}
def create_lead(self, cr, uid, ids, context=None):
'''Function called by the related button of the wizard'''
if context is None:
context = {}
wiz = self.browse(cr, uid, ids[0], context=context)
action = {
'name': _('Create New Lead'),
'type': 'ir.actions.act_window',
'res_model': 'crm.lead',
'view_mode': 'form,tree',
'domain': ['|', ('type', '=', 'lead'), ('type', '=', False)],
'nodestroy': False,
'target': 'current',
'context': {
'default_%s' % wiz.number_type: wiz.e164_number,
'default_type': 'lead',
'stage_type': 'lead',
'needaction_menu_ref': 'crm.menu_crm_opportunities',
},
}
return action
def update_lead(self, cr, uid, ids, context=None):
wiz = self.browse(cr, uid, ids[0], context=context)
if not wiz.to_update_lead_id:
raise orm.except_orm(
_('Error:'),
_("Select the Lead to Update."))
self.pool['crm.lead'].write(
cr, uid, wiz.to_update_lead_id.id,
{wiz.number_type: wiz.e164_number}, context=context)
action = {
'name': _('Lead: %s' % wiz.to_update_lead_id.name),
'type': 'ir.actions.act_window',
'res_model': 'crm.lead',
'view_mode': 'form,tree',
'nodestroy': False,
'target': 'current',
'res_id': wiz.to_update_lead_id.id,
'context': {
'stage_type': 'lead',
'needaction_menu_ref': 'crm.menu_crm_opportunities',
},
}
return action
def onchange_to_update_lead(
self, cr, uid, ids, to_update_lead_id, context=None):
res = {'value': {}}
if to_update_lead_id:
to_update_lead = self.pool['crm.lead'].browse(
cr, uid, to_update_lead_id, context=context)
res['value'].update({
'current_lead_phone': to_update_lead.phone,
'current_lead_mobile': to_update_lead.mobile,
})
else:
res['value'].update({
'current_lead_phone': False,
'current_lead_mobile': False,
})
return res

36
crm_phone/wizard/number_not_found_view.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
CRM Phone module for OpenERP
Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="number_not_found_form" model="ir.ui.view">
<field name="name">crm_phone.number.not.found.form</field>
<field name="model">number.not.found</field>
<field name="inherit_id" ref="base_phone.number_not_found_form"/>
<field name="arch" type="xml">
<group name="create-update" position="inside">
<group name="lead" string="Create or Update a Lead"
colspan="1" col="2">
<button name="create_lead" icon="gtk-new" colspan="2"
string="Create Lead with this Number" type="object"/>
<field name="to_update_lead_id"
on_change="onchange_to_update_lead(to_update_lead_id)"/>
<field name="current_lead_phone" widget="phone"
options="{'dial_button_invisible': True}"/>
<field name="current_lead_mobile" widget="phone"
options="{'dial_button_invisible': True}"/>
<button name="update_lead" icon="gtk-convert" colspan="2"
string="Update Lead with this Number" type="object"/>
</group>
</group>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save