From 787ae637af2dcd6cb5f4587eab198634a765e3d6 Mon Sep 17 00:00:00 2001 From: "Trever L. Adams" Date: Tue, 23 Aug 2016 09:55:48 -0600 Subject: [PATCH] Fix several bugs. Refactor and cleanup code. --- crm_voip_logcall/README.rst | 2 +- logcall/models/crm_phonecall.py | 13 ++++++++----- logcall/views/crm_phonecall_view.xml | 25 +++++++++---------------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/crm_voip_logcall/README.rst b/crm_voip_logcall/README.rst index dc2366d..8581503 100644 --- a/crm_voip_logcall/README.rst +++ b/crm_voip_logcall/README.rst @@ -1,4 +1,4 @@ CRM VoIP Phone Log-call ======================= -This bridge pulls in a configuration ption for use by logcall. This enables linking to call recordings in the logcall functionality. +This bridge pulls in a configuration option for use by logcall. This enables linking to call recordings in the logcall functionality. diff --git a/logcall/models/crm_phonecall.py b/logcall/models/crm_phonecall.py index 964c9a5..1793445 100644 --- a/logcall/models/crm_phonecall.py +++ b/logcall/models/crm_phonecall.py @@ -32,9 +32,6 @@ logger = logging.getLogger(__name__) class ResUsers(models.Model): _inherit = 'res.users' - end_date = fields.Datetime( - string='End Date', track_visibility='onchange', copy=False, - default=lambda self: fields.Datetime.now()) context_auto_log_calls = fields.Boolean( string='Automatically Log Incoming Calls', default=True) @@ -42,6 +39,9 @@ class ResUsers(models.Model): class CrmPhonecall(models.Model): _inherit = "crm.phonecall" + end_date = fields.Datetime( + string='End Date', track_visibility='onchange', copy=False, + default=lambda self: fields.Datetime.now()) recording_id = fields.Many2one('ir.attachment', string='Call Recording', readonly=True) @@ -146,8 +146,11 @@ class PhoneCommon(models.AbstractModel): odoo_start = \ phonecalls[0]['date'].strptime('%Y-%m-%d %H:%M:%S') if phonecalls[0]['description']: - odoo_description = phonecalls[0]['description'] + '\n' + \ - odoo_description + if phonecalls[0]['description'].find(odoo_description) != -1: + odoo_description = phonecalls[0]['description'] + '\n' + \ + odoo_description + else: + odoo_description = phonecalls[0]['description'] if phonecalls[0]['recording_id']: attach_id = phonecalls[0]['recording_id'] phonecall_id = phonecalls[0] diff --git a/logcall/views/crm_phonecall_view.xml b/logcall/views/crm_phonecall_view.xml index a28b109..5c28471 100644 --- a/logcall/views/crm_phonecall_view.xml +++ b/logcall/views/crm_phonecall_view.xml @@ -7,17 +7,12 @@ crm.phonecall -
- - - - - - - - - -
+ + + + + +
@@ -39,11 +34,9 @@ crm.phonecall.search crm.phonecall - - - - - + + +