Browse Source

Better context handling

Update in comments
6.0
Alexis de Lattre 14 years ago
parent
commit
27e9117c83
  1. 10
      asterisk_click2dial/asterisk_click2dial.py
  2. 8
      asterisk_click2dial/scripts/get_cid_name_timeout.sh

10
asterisk_click2dial/asterisk_click2dial.py

@ -120,7 +120,7 @@ class asterisk_server(osv.osv):
]
def reformat_number(self, cr, uid, ids, erp_number, ast_server, context):
def reformat_number(self, cr, uid, ids, erp_number, ast_server, context=None):
'''
This function is dedicated to the transformation of the number
available in OpenERP to the number that Asterisk should dial.
@ -284,17 +284,17 @@ class res_partner_address(osv.osv):
_name = "res.partner.address"
_inherit = "res.partner.address"
def action_dial_phone(self, cr, uid, ids, context):
def action_dial_phone(self, cr, uid, ids, context=None):
'''Function called by the button 'Dial' next to the 'phone' field
in the partner address view'''
erp_number = self.read(cr, uid, ids, ['phone'], context=context)[0]['phone']
self.pool.get('asterisk.server').dial(cr, uid, ids, erp_number, context)
self.pool.get('asterisk.server').dial(cr, uid, ids, erp_number, context=context)
def action_dial_mobile(self, cr, uid, ids, context):
def action_dial_mobile(self, cr, uid, ids, context=None):
'''Function called by the button 'Dial' next to the 'mobile' field
in the partner address view'''
erp_number = self.read(cr, uid, ids, ['mobile'], context=context)[0]['mobile']
self.pool.get('asterisk.server').dial(cr, uid, ids, erp_number, context)
self.pool.get('asterisk.server').dial(cr, uid, ids, erp_number, context=context)
def get_name_from_phone_number(self, cr, uid, number, context=None):
'''Function to get name from phone number. Usefull for use from Asterisk

8
asterisk_click2dial/scripts/get_cid_name_timeout.sh

@ -7,11 +7,11 @@
# Limiting the execution time of get_cid_name.py is important because
# the script is designed to be executed at the beginning of each
# incoming phone call... and if the script get stucks, the phone call
# will also get stucks and you will miss a call !
# will also get stucks and you will miss the call !
# For Debian Lenny, you need to install the package "timeout"
# For Ubuntu and Debian >= Squeeze, the "timeout" command is shipped in
# the "coreutils" package
# 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 1 second

Loading…
Cancel
Save