From f95d04eea3adb9f32aa79ca658c487f33237aaeb Mon Sep 17 00:00:00 2001 From: "Trever L. Adams" Date: Tue, 13 Jun 2017 15:28:32 -0600 Subject: [PATCH] More PEP8 related cleanups. --- asterisk_logcall/__openerp__.py | 2 +- asterisk_logcall/models/asterisk_server.py | 9 +++++---- freeswitch_click2dial/controller.py | 4 ++-- freeswitch_logcall/__openerp__.py | 2 +- freeswitch_logcall/models/freeswitch_server.py | 9 +++++---- hr_recruitment_phone_log/models/recruitment.py | 4 ++-- logcall/models/crm_phonecall.py | 3 ++- logcall/scripts/asterisk_logcall.py | 5 ++++- 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/asterisk_logcall/__openerp__.py b/asterisk_logcall/__openerp__.py index cdc559a..9659a82 100644 --- a/asterisk_logcall/__openerp__.py +++ b/asterisk_logcall/__openerp__.py @@ -8,7 +8,7 @@ 'category': 'Phone', 'license': 'AGPL-3', 'summary': 'Necessary bridge between log-call and Asterisk Click2dial', - 'author': "Trever L. Adams", + 'author': "Trever L. Adams,Odoo Community Association (OCA)", 'website': '', 'depends': ['logcall', 'asterisk_click2dial'], 'data': [ diff --git a/asterisk_logcall/models/asterisk_server.py b/asterisk_logcall/models/asterisk_server.py index f511688..002bfcd 100644 --- a/asterisk_logcall/models/asterisk_server.py +++ b/asterisk_logcall/models/asterisk_server.py @@ -15,7 +15,8 @@ class AsteriskServer(models.Model): ucp_url = fields.Char( 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}" "(source phone number}, {odoo_dst} (destination number), " "{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 ' 'new call end, for call merging, to compensate for system/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.', default=5) diff --git a/freeswitch_click2dial/controller.py b/freeswitch_click2dial/controller.py index 204c681..3f8d94f 100644 --- a/freeswitch_click2dial/controller.py +++ b/freeswitch_click2dial/controller.py @@ -14,5 +14,5 @@ class FreeSWITCHClick2dialController(http.Controller): '/freeswitch_click2dial/get_record_from_my_channel/', type='json', auth='public') 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() diff --git a/freeswitch_logcall/__openerp__.py b/freeswitch_logcall/__openerp__.py index 2f99ca3..50b6dea 100644 --- a/freeswitch_logcall/__openerp__.py +++ b/freeswitch_logcall/__openerp__.py @@ -10,7 +10,7 @@ 'category': 'Phone', 'license': 'AGPL-3', 'summary': 'Necessary bridge between log-call and FreeSWITCH Click2dial', - 'author': "Trever L. Adams", + 'author': "Trever L. Adams,Odoo Community Association (OCA)", 'website': '', 'depends': ['logcall', 'freeswitch_click2dial'], 'data': [ diff --git a/freeswitch_logcall/models/freeswitch_server.py b/freeswitch_logcall/models/freeswitch_server.py index b4b9064..b02df91 100644 --- a/freeswitch_logcall/models/freeswitch_server.py +++ b/freeswitch_logcall/models/freeswitch_server.py @@ -15,7 +15,8 @@ class FreeSWITCHServer(models.Model): ucp_url = fields.Char( 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}" "(source phone number}, {odoo_dst} (destination number), " "{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 ' 'new call end, for call merging, to compensate for system/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.', default=5) diff --git a/hr_recruitment_phone_log/models/recruitment.py b/hr_recruitment_phone_log/models/recruitment.py index e3eb728..e7ebfc6 100644 --- a/hr_recruitment_phone_log/models/recruitment.py +++ b/hr_recruitment_phone_log/models/recruitment.py @@ -19,12 +19,12 @@ class HrApplicant(models.Model): phonecall_ids = fields.One2many('crm.phonecall', 'hr_applicant_id', string='Phone Calls') phonecall_count = fields.Integer( - compute='_count_phonecalls', string='Number of Phonecalls', + compute='_compute_count_phonecalls', string='Number of Phonecalls', readonly=True) @api.multi @api.depends('phonecall_ids') - def _count_phonecalls(self): + def _compute_count_phonecalls(self): cpo = self.env['crm.phonecall'] for applicant in self: try: diff --git a/logcall/models/crm_phonecall.py b/logcall/models/crm_phonecall.py index b69f25f..90c11b7 100644 --- a/logcall/models/crm_phonecall.py +++ b/logcall/models/crm_phonecall.py @@ -146,6 +146,7 @@ class PhoneCommon(models.AbstractModel): if odoo_filename and not attach_id: base_url = self._get_ucp_url(users[0]) + fixed_uuid = odoo_uniqueid.replace('.', '_') ir_attachment_data = { 'res_model': 'crm.phonecall', 'res_id': phonecall_id.id, @@ -159,7 +160,7 @@ class PhoneCommon(models.AbstractModel): odoo_dst=odoo_dst, odoo_duration=odoo_duration, odoo_start=odoo_start, - odoo_uniqueid=odoo_uniqueid.replace('.', '_'), + odoo_uniqueid=fixed_uuid, odoo_filename=odoo_filename), 'datas_fname': odoo_filename, } diff --git a/logcall/scripts/asterisk_logcall.py b/logcall/scripts/asterisk_logcall.py index d37e1f4..d60edaa 100755 --- a/logcall/scripts/asterisk_logcall.py +++ b/logcall/scripts/asterisk_logcall.py @@ -4,6 +4,7 @@ # (c) 2016 credativ Ltd (). # (c) 2016 Trever L. Adams # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +# flake8: noqa: E501 """ Log a call and recording within Asterisk @@ -43,7 +44,8 @@ EOF """ -__author__ = "Craig Gowing & Alexis de Lattre " +__author__ = """Craig Gowing & + Alexis de Lattre """ __date__ = "February 2016" __version__ = "0.2" @@ -184,6 +186,7 @@ def main(options, arguments): return True + if __name__ == '__main__': usage = "Usage: asterisk_logcall.py [options] login1 login2 login3 ..." epilog = "Script written by Craig Gowing based on work by Alexis de "