Browse Source

More PEP8 related cleanups.

pull/101/head
Trever L. Adams 8 years ago
parent
commit
f95d04eea3
  1. 2
      asterisk_logcall/__openerp__.py
  2. 9
      asterisk_logcall/models/asterisk_server.py
  3. 4
      freeswitch_click2dial/controller.py
  4. 2
      freeswitch_logcall/__openerp__.py
  5. 9
      freeswitch_logcall/models/freeswitch_server.py
  6. 4
      hr_recruitment_phone_log/models/recruitment.py
  7. 3
      logcall/models/crm_phonecall.py
  8. 5
      logcall/scripts/asterisk_logcall.py

2
asterisk_logcall/__openerp__.py

@ -8,7 +8,7 @@
'category': 'Phone', 'category': 'Phone',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Necessary bridge between log-call and Asterisk Click2dial', 'summary': 'Necessary bridge between log-call and Asterisk Click2dial',
'author': "Trever L. Adams",
'author': "Trever L. Adams,Odoo Community Association (OCA)",
'website': '', 'website': '',
'depends': ['logcall', 'asterisk_click2dial'], 'depends': ['logcall', 'asterisk_click2dial'],
'data': [ 'data': [

9
asterisk_logcall/models/asterisk_server.py

@ -15,7 +15,8 @@ class AsteriskServer(models.Model):
ucp_url = fields.Char( ucp_url = fields.Char(
string='Script to download FreeSWITCH recordings', required=False, string='Script to download FreeSWITCH recordings', required=False,
default="https://localhost/cgi-bin/get_recording.pl?file={odoo_filename}",
default="https://localhost/cgi-bin/get_recording.pl?"
"file={odoo_filename}",
help="Macros allowed: {odoo_type} (inbound, outbound), {odoo_src}" help="Macros allowed: {odoo_type} (inbound, outbound), {odoo_src}"
"(source phone number}, {odoo_dst} (destination number), " "(source phone number}, {odoo_dst} (destination number), "
"{odoo_duration} (length of call), {odoo_start} (start time of call " "{odoo_duration} (length of call), {odoo_start} (start time of call "
@ -26,9 +27,9 @@ class AsteriskServer(models.Model):
help='Number of seconds to subtract from new call start and add to ' help='Number of seconds to subtract from new call start and add to '
'new call end, for call merging, to compensate for system/database ' 'new call end, for call merging, to compensate for system/database '
'load and time drift between Asterisk server and Odoo/Odoo database ' 'load and time drift between Asterisk server and Odoo/Odoo database '
'server(s). 5 seconds is likely a good start. Above 10 seconds you get '
'into the realm where you may have distinct calls confused. 20 - 30 '
'seconds begins to guarantee this. It is best to keep this low '
'server(s). 5 seconds is likely a good start. Above 10 seconds you '
'get into the realm where you may have distinct calls confused. 20 - '
'30 seconds begins to guarantee this. It is best to keep this low '
'and use a method to keep time synced.', 'and use a method to keep time synced.',
default=5) default=5)

4
freeswitch_click2dial/controller.py

@ -14,5 +14,5 @@ class FreeSWITCHClick2dialController(http.Controller):
'/freeswitch_click2dial/get_record_from_my_channel/', '/freeswitch_click2dial/get_record_from_my_channel/',
type='json', auth='public') type='json', auth='public')
def get_record_from_my_channel(self, **kw): def get_record_from_my_channel(self, **kw):
FreeswitchServer = http.request.env['freeswitch.server']
return FreeswitchServer.get_record_from_my_channel()
FreeswitchServer = http.request.env['freeswitch.server']
return FreeswitchServer.get_record_from_my_channel()

2
freeswitch_logcall/__openerp__.py

@ -10,7 +10,7 @@
'category': 'Phone', 'category': 'Phone',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Necessary bridge between log-call and FreeSWITCH Click2dial', 'summary': 'Necessary bridge between log-call and FreeSWITCH Click2dial',
'author': "Trever L. Adams",
'author': "Trever L. Adams,Odoo Community Association (OCA)",
'website': '', 'website': '',
'depends': ['logcall', 'freeswitch_click2dial'], 'depends': ['logcall', 'freeswitch_click2dial'],
'data': [ 'data': [

9
freeswitch_logcall/models/freeswitch_server.py

@ -15,7 +15,8 @@ class FreeSWITCHServer(models.Model):
ucp_url = fields.Char( ucp_url = fields.Char(
string='Script to download FreeSWITCH recordings', required=False, string='Script to download FreeSWITCH recordings', required=False,
default="https://localhost/cgi-bin/get_recording.pl?file={odoo_filename}",
default="https://localhost/cgi-bin/get_recording.pl?"
"file={odoo_filename}",
help="Macros allowed: {odoo_type} (inbound, outbound), {odoo_src}" help="Macros allowed: {odoo_type} (inbound, outbound), {odoo_src}"
"(source phone number}, {odoo_dst} (destination number), " "(source phone number}, {odoo_dst} (destination number), "
"{odoo_duration} (length of call), {odoo_start} (start time of call " "{odoo_duration} (length of call), {odoo_start} (start time of call "
@ -26,9 +27,9 @@ class FreeSWITCHServer(models.Model):
help='Number of seconds to subtract from new call start and add to ' help='Number of seconds to subtract from new call start and add to '
'new call end, for call merging, to compensate for system/database ' 'new call end, for call merging, to compensate for system/database '
'load and time drift between FreeSWITCH server and Odoo/Odoo database ' 'load and time drift between FreeSWITCH server and Odoo/Odoo database '
'server(s). 5 seconds is likely a good start. Above 10 seconds you get '
'into the realm where you may have distinct calls confused. 20 - 30 '
'seconds begins to guarantee this. It is best to keep this low '
'server(s). 5 seconds is likely a good start. Above 10 seconds you '
'get into the realm where you may have distinct calls confused. 20 - '
'30 seconds begins to guarantee this. It is best to keep this low '
'and use a method to keep time synced.', 'and use a method to keep time synced.',
default=5) default=5)

4
hr_recruitment_phone_log/models/recruitment.py

@ -19,12 +19,12 @@ class HrApplicant(models.Model):
phonecall_ids = fields.One2many('crm.phonecall', 'hr_applicant_id', phonecall_ids = fields.One2many('crm.phonecall', 'hr_applicant_id',
string='Phone Calls') string='Phone Calls')
phonecall_count = fields.Integer( phonecall_count = fields.Integer(
compute='_count_phonecalls', string='Number of Phonecalls',
compute='_compute_count_phonecalls', string='Number of Phonecalls',
readonly=True) readonly=True)
@api.multi @api.multi
@api.depends('phonecall_ids') @api.depends('phonecall_ids')
def _count_phonecalls(self):
def _compute_count_phonecalls(self):
cpo = self.env['crm.phonecall'] cpo = self.env['crm.phonecall']
for applicant in self: for applicant in self:
try: try:

3
logcall/models/crm_phonecall.py

@ -146,6 +146,7 @@ class PhoneCommon(models.AbstractModel):
if odoo_filename and not attach_id: if odoo_filename and not attach_id:
base_url = self._get_ucp_url(users[0]) base_url = self._get_ucp_url(users[0])
fixed_uuid = odoo_uniqueid.replace('.', '_')
ir_attachment_data = { ir_attachment_data = {
'res_model': 'crm.phonecall', 'res_model': 'crm.phonecall',
'res_id': phonecall_id.id, 'res_id': phonecall_id.id,
@ -159,7 +160,7 @@ class PhoneCommon(models.AbstractModel):
odoo_dst=odoo_dst, odoo_dst=odoo_dst,
odoo_duration=odoo_duration, odoo_duration=odoo_duration,
odoo_start=odoo_start, odoo_start=odoo_start,
odoo_uniqueid=odoo_uniqueid.replace('.', '_'),
odoo_uniqueid=fixed_uuid,
odoo_filename=odoo_filename), odoo_filename=odoo_filename),
'datas_fname': odoo_filename, 'datas_fname': odoo_filename,
} }

5
logcall/scripts/asterisk_logcall.py

@ -4,6 +4,7 @@
# (c) 2016 credativ Ltd (<http://credativ.co.uk>). # (c) 2016 credativ Ltd (<http://credativ.co.uk>).
# (c) 2016 Trever L. Adams # (c) 2016 Trever L. Adams
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
# flake8: noqa: E501
""" """
Log a call and recording within Asterisk Log a call and recording within Asterisk
@ -43,7 +44,8 @@ EOF
""" """
__author__ = "Craig Gowing <craig.gowing@credativ.co.uk> & Alexis de Lattre <alexis.delattre@akretion.com>"
__author__ = """Craig Gowing <craig.gowing@credativ.co.uk> &
Alexis de Lattre <alexis.delattre@akretion.com>"""
__date__ = "February 2016" __date__ = "February 2016"
__version__ = "0.2" __version__ = "0.2"
@ -184,6 +186,7 @@ def main(options, arguments):
return True return True
if __name__ == '__main__': if __name__ == '__main__':
usage = "Usage: asterisk_logcall.py [options] login1 login2 login3 ..." usage = "Usage: asterisk_logcall.py [options] login1 login2 login3 ..."
epilog = "Script written by Craig Gowing based on work by Alexis de " epilog = "Script written by Craig Gowing based on work by Alexis de "

Loading…
Cancel
Save