From 27e9117c839dae99a5b09f66abf213666790e57b Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 29 Dec 2010 19:43:08 +0100 Subject: [PATCH] Better context handling Update in comments --- asterisk_click2dial/asterisk_click2dial.py | 10 +++++----- asterisk_click2dial/scripts/get_cid_name_timeout.sh | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/asterisk_click2dial/asterisk_click2dial.py b/asterisk_click2dial/asterisk_click2dial.py index 4f75dbb..eff42ba 100644 --- a/asterisk_click2dial/asterisk_click2dial.py +++ b/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 diff --git a/asterisk_click2dial/scripts/get_cid_name_timeout.sh b/asterisk_click2dial/scripts/get_cid_name_timeout.sh index 35f89ad..d9d3edc 100755 --- a/asterisk_click2dial/scripts/get_cid_name_timeout.sh +++ b/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