diff --git a/asterisk_logcall/README.rst b/asterisk_logcall/README.rst new file mode 100644 index 0000000..5d060fb --- /dev/null +++ b/asterisk_logcall/README.rst @@ -0,0 +1,6 @@ +Asterisk Phone Log-call +========================= + +This bridge adds an option to the Asterisk IPBX servers for the URL to pull +down call recordings. It also adds an option for time jitter compensation +for use when automatically merging call records. diff --git a/asterisk_logcall/__init__.py b/asterisk_logcall/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/asterisk_logcall/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/asterisk_logcall/__openerp__.py b/asterisk_logcall/__openerp__.py new file mode 100644 index 0000000..ccb6dca --- /dev/null +++ b/asterisk_logcall/__openerp__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Phone Log-call module for Odoo/OpenERP +# Copyright (C) 2016 credativ Ltd (). +# Copyright (C) 2016 Trever L. Adams +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Asterisk Phone Log-call', + 'version': '9.0.0.1.0', + 'category': 'Phone', + 'license': 'AGPL-3', + 'summary': 'Necessary bridge between log-call and Asterisk Click2dial', + 'author': "Trever L. Adams", + 'website': '', + 'depends': ['logcall', 'asterisk_click2dial'], + 'data': [ + 'security/ir.model.access.csv', + 'views/asterisk_server_view.xml', + ], + 'application': True, + 'installable': True, +} diff --git a/asterisk_logcall/models/__init__.py b/asterisk_logcall/models/__init__.py new file mode 100644 index 0000000..2d568e0 --- /dev/null +++ b/asterisk_logcall/models/__init__.py @@ -0,0 +1,2 @@ +from . import asterisk_server + diff --git a/asterisk_logcall/models/asterisk_server.py b/asterisk_logcall/models/asterisk_server.py new file mode 100644 index 0000000..cce2a4f --- /dev/null +++ b/asterisk_logcall/models/asterisk_server.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Phone Log-call module for Odoo/OpenERP +# Copyright (C) 2016 credativ Ltd (). +# Copyright (C) 2016 Trever L. Adams +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api +import logging + + +logger = logging.getLogger(__name__) + + +class AsteriskServer(models.Model): + _inherit = "asterisk.server" + + ucp_url = fields.Char( + string='Script to download FreeSWITCH recordings', required=False, + 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 " + "in seconds since epoch), {odoo_filename} (file name on server), " + "{odoo_uniqueid} (FreeSWITCH UUID of call).") + server_jitter_correction = fields.Integer( + string='Time jitter compensation', required=True, + 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 ' + 'and use a method to keep time synced.', + default=5) + + +class PhoneCommon(models.AbstractModel): + _inherit = 'phone.common' + + @api.model + def _get_ucp_url(self, users): + asterisk_server = users[0].get_asterisk_server_from_user() + return asterisk_server.ucp_url + + @api.model + def _get_jitter(self, users): + asterisk_server = users[0].get_asterisk_server_from_user() + return asterisk_server.server_jitter_correction diff --git a/asterisk_logcall/security/ir.model.access.csv b/asterisk_logcall/security/ir.model.access.csv new file mode 100644 index 0000000..588f44d --- /dev/null +++ b/asterisk_logcall/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +ir_model_access_asterisk_server_phone_integration,Read access on asterisk.server,asterisk_click2dial.model_asterisk_server,logcall.group_phone_system_integration,1,0,0,0 diff --git a/asterisk_logcall/views/asterisk_server_view.xml b/asterisk_logcall/views/asterisk_server_view.xml new file mode 100644 index 0000000..c9073f1 --- /dev/null +++ b/asterisk_logcall/views/asterisk_server_view.xml @@ -0,0 +1,27 @@ + + + + + + + + Asterisk IPBX Servers + asterisk.server + + + + + + + + + + + + + + diff --git a/crm_phone/__openerp__.py b/crm_phone/__openerp__.py index 0fdc4c9..d771271 100644 --- a/crm_phone/__openerp__.py +++ b/crm_phone/__openerp__.py @@ -4,7 +4,7 @@ { 'name': 'CRM Phone', - 'version': '9.0.1.0.0', + 'version': '9.0.1.0.2', 'category': 'Phone', 'license': 'AGPL-3', 'summary': 'Validate phone numbers in CRM', diff --git a/crm_phone/crm_phone.py b/crm_phone/crm_phone.py index 020ebaa..a415459 100644 --- a/crm_phone/crm_phone.py +++ b/crm_phone/crm_phone.py @@ -61,6 +61,9 @@ class CrmPhonecall(models.Model): date = fields.Datetime( string='Date', track_visibility='onchange', copy=False, default=lambda self: fields.Datetime.now()) + end_date = fields.Datetime( + string='End Date', track_visibility='onchange', copy=False, + default=lambda self: fields.Datetime.now()) description = fields.Text(string='Description', copy=False) company_id = fields.Many2one( 'res.company', string='Company', diff --git a/crm_phone/view/crm_phonecall.xml b/crm_phone/view/crm_phonecall.xml index 9d538b9..b9771a4 100644 --- a/crm_phone/view/crm_phonecall.xml +++ b/crm_phone/view/crm_phonecall.xml @@ -31,6 +31,7 @@ + @@ -63,6 +64,7 @@ + @@ -80,7 +82,7 @@ crm.phonecall.calendar crm.phonecall - + @@ -94,6 +96,7 @@ + diff --git a/crm_voip_logcall/README.rst b/crm_voip_logcall/README.rst new file mode 100644 index 0000000..dc2366d --- /dev/null +++ b/crm_voip_logcall/README.rst @@ -0,0 +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. diff --git a/crm_voip_logcall/__init__.py b/crm_voip_logcall/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/crm_voip_logcall/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/crm_voip_logcall/__openerp__.py b/crm_voip_logcall/__openerp__.py new file mode 100644 index 0000000..a87920e --- /dev/null +++ b/crm_voip_logcall/__openerp__.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Phone Log-call module for Odoo/OpenERP +# Copyright (C) 2016 credativ Ltd (). +# Copyright (C) 2016 Trever L. Adams +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'CRM Voip Phone Log-call', + 'version': '9.0.0.1.0', + 'category': 'Phone', + 'license': 'AGPL-3', + 'summary': 'Necessary bridge between log-call and CRM VoIP module', + 'author': "Trever L. Adams", + 'website': '', + 'depends': ['logcall', 'crm_voip'], + 'application': True, + 'installable': False, +} diff --git a/crm_voip_logcall/models/__init__.py b/crm_voip_logcall/models/__init__.py new file mode 100644 index 0000000..b48fe24 --- /dev/null +++ b/crm_voip_logcall/models/__init__.py @@ -0,0 +1,2 @@ +from . import freeswitch_server + diff --git a/crm_voip_logcall/models/crm_voip_logcall.py b/crm_voip_logcall/models/crm_voip_logcall.py new file mode 100644 index 0000000..f470542 --- /dev/null +++ b/crm_voip_logcall/models/crm_voip_logcall.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Phone Log-call module for Odoo/OpenERP +# Copyright (C) 2016 credativ Ltd (). +# Copyright (C) 2016 Trever L. Adams +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, api +import logging + + +logger = logging.getLogger(__name__) + + +class PhoneCommon(models.AbstractModel): + _inherit = 'phone.common' + + @api.model + def _get_ucp_url(self, users): + base_url = params.get_param('crm.voip.ucp_url', default='http://localhost/ucp?quietmode=1&module=cdr&command=download&msgid={odoo_uniqueid}&type=download&format=wav&ext={caller_user}') + return base_url diff --git a/freeswitch_logcall/README.rst b/freeswitch_logcall/README.rst new file mode 100644 index 0000000..2d7cf78 --- /dev/null +++ b/freeswitch_logcall/README.rst @@ -0,0 +1,6 @@ +FreeSWITCH Phone Log-call +========================= + +This bridge adds an option to the FreeSWITCH servers for the URL to pull +down call recordings. It also adds an option for time jitter compensation +for use when automatically merging call records. diff --git a/freeswitch_logcall/__init__.py b/freeswitch_logcall/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/freeswitch_logcall/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/freeswitch_logcall/__openerp__.py b/freeswitch_logcall/__openerp__.py new file mode 100644 index 0000000..4dc1fb3 --- /dev/null +++ b/freeswitch_logcall/__openerp__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Phone Log-call module for Odoo/OpenERP +# Copyright (C) 2016 credativ Ltd (). +# Copyright (C) 2016 Trever L. Adams +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'FreeSwitch Phone Log-call', + 'version': '9.0.0.1.0', + 'category': 'Phone', + 'license': 'AGPL-3', + 'summary': 'Necessary bridge between log-call and FreeSWITCH Click2dial', + 'author': "Trever L. Adams", + 'website': '', + 'depends': ['logcall', 'freeswitch_click2dial'], + 'data': [ + 'security/ir.model.access.csv', + 'views/freeswitch_server_view.xml', + ], + 'application': True, + 'installable': True, +} diff --git a/freeswitch_logcall/models/__init__.py b/freeswitch_logcall/models/__init__.py new file mode 100644 index 0000000..b48fe24 --- /dev/null +++ b/freeswitch_logcall/models/__init__.py @@ -0,0 +1,2 @@ +from . import freeswitch_server + diff --git a/freeswitch_logcall/models/freeswitch_server.py b/freeswitch_logcall/models/freeswitch_server.py new file mode 100644 index 0000000..8a6dfa6 --- /dev/null +++ b/freeswitch_logcall/models/freeswitch_server.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Phone Log-call module for Odoo/OpenERP +# Copyright (C) 2016 credativ Ltd (). +# Copyright (C) 2016 Trever L. Adams +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api +import logging + + +logger = logging.getLogger(__name__) + + +class FreeSWITCHServer(models.Model): + _inherit = "freeswitch.server" + + ucp_url = fields.Char( + string='Script to download FreeSWITCH recordings', required=False, + 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 " + "in seconds since epoch), {odoo_filename} (file name on server), " + "{odoo_uniqueid} (FreeSWITCH UUID of call).") + server_jitter_correction = fields.Integer( + string='Time jitter compensation', required=True, + 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 ' + 'and use a method to keep time synced.', + default=5) + + +class PhoneCommon(models.AbstractModel): + _inherit = 'phone.common' + + @api.model + def _get_ucp_url(self, user): + fs_server = user.freeswitch_server_id + return fs_server.ucp_url + + @api.model + def _get_jitter(self, user): + fs_server = user.freeswitch_server_id + return fs_server.server_jitter_correction diff --git a/freeswitch_logcall/security/ir.model.access.csv b/freeswitch_logcall/security/ir.model.access.csv new file mode 100644 index 0000000..6a73559 --- /dev/null +++ b/freeswitch_logcall/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +ir_model_access_freeswitch_server_phone_integration,Read access on freeswitch.server,freeswitch_click2dial.model_freeswitch_server,logcall.group_phone_system_integration,1,0,0,0 diff --git a/freeswitch_logcall/views/freeswitch_server_view.xml b/freeswitch_logcall/views/freeswitch_server_view.xml new file mode 100644 index 0000000..ea2bcf4 --- /dev/null +++ b/freeswitch_logcall/views/freeswitch_server_view.xml @@ -0,0 +1,26 @@ + + + + + + + + FreeSWITCH Servers + freeswitch.server + + + + + + + + + + + + + diff --git a/hr_recruitment_phone_log/README.rst b/hr_recruitment_phone_log/README.rst new file mode 100644 index 0000000..3c59a9c --- /dev/null +++ b/hr_recruitment_phone_log/README.rst @@ -0,0 +1,44 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +========================== +Show phonecalls on partner +========================== + +This module restores the phonecall list on the partner view. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/140/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + +Credits +======= + +Contributors +------------ + +* Ondřej Kuzník + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/hr_recruitment_phone_log/__init__.py b/hr_recruitment_phone_log/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/hr_recruitment_phone_log/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/hr_recruitment_phone_log/__openerp__.py b/hr_recruitment_phone_log/__openerp__.py new file mode 100644 index 0000000..f7edf54 --- /dev/null +++ b/hr_recruitment_phone_log/__openerp__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# (c) 2016 credativ ltd. - Ondřej Kuzník +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + 'name': 'Show phonecalls on HR Applicant', + 'summary': 'Adds a phonecall log to HR Applicant', + 'version': '9.0.1.0.0', + 'category': 'Human Resources', + 'author': 'credativ ltd., ' + 'Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'depends': [ + 'logcall', + 'hr_recruitment_phone', + ], + 'data': [ + 'security/ir.model.access.csv', + 'views/recruitment_view.xml', + ], + 'application': True, + 'installable': True, +} diff --git a/hr_recruitment_phone_log/models/__init__.py b/hr_recruitment_phone_log/models/__init__.py new file mode 100644 index 0000000..9ca9c7d --- /dev/null +++ b/hr_recruitment_phone_log/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import recruitment diff --git a/hr_recruitment_phone_log/models/recruitment.py b/hr_recruitment_phone_log/models/recruitment.py new file mode 100644 index 0000000..1d11500 --- /dev/null +++ b/hr_recruitment_phone_log/models/recruitment.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# (c) 2016 credativ ltd. - Ondřej Kuzník +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp import models, fields, api + + +class CrmPhonecall(models.Model): + _inherit = "crm.phonecall" + + hr_applicant_id = fields.Many2one( + 'hr.applicant', string='Applicant', ondelete='cascade') + + +class HrApplicant(models.Model): + _inherit = 'hr.applicant' + + phonecall_ids = fields.One2many('crm.phonecall', 'hr_applicant_id', string='Phone Calls') + phonecall_count = fields.Integer( + compute='_count_phonecalls', string='Number of Phonecalls', + readonly=True) + + @api.multi + @api.depends('phonecall_ids') + def _count_phonecalls(self): + cpo = self.env['crm.phonecall'] + for applicant in self: + try: + applicant.phonecall_count = cpo.search_count( + [('hr_applicant_id', '=', applicant.id)]) + except: + applicant.phonecall_count = 0 diff --git a/hr_recruitment_phone_log/security/ir.model.access.csv b/hr_recruitment_phone_log/security/ir.model.access.csv new file mode 100644 index 0000000..e381a1a --- /dev/null +++ b/hr_recruitment_phone_log/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +phone_system_integration_hr_applicant_write,Write access on hr.applicant for phone system integration and call logging,hr_recruitment.model_hr_applicant,logcall.group_phone_system_integration,1,1,0,0 diff --git a/hr_recruitment_phone_log/views/recruitment_view.xml b/hr_recruitment_phone_log/views/recruitment_view.xml new file mode 100644 index 0000000..df9e877 --- /dev/null +++ b/hr_recruitment_phone_log/views/recruitment_view.xml @@ -0,0 +1,56 @@ + + + + + + crm.phonecall.search + crm.phonecall + + + + + + + + + + hr_recruitment_phone.hr_applicant.form + hr.applicant + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/logcall/README.rst b/logcall/README.rst new file mode 100644 index 0000000..b64a513 --- /dev/null +++ b/logcall/README.rst @@ -0,0 +1,18 @@ +Phone Log-call +================= + +When a call has completed within Asterisk, FreeSWITCH or similar +a callback can be added in a hangup handler to call a script +which sends a request to Odoo to log the call. + +This module requires a module providing _get_ucp_url and _get_jitter +functions in PhoneCommon. These provide a URL template for downloading +recordings (false is fine) and the number of seconds to use to make +sure there are no problems in merging call logs, respectively. + +Merging of call logs is automatic if, and only if, the call existing in +the database as a state time between the start of the new call minus jitter +and end of the new call plus jitter. It keep the data making the call the +longest. It will keep the original attachment, ignoring a new one. It will +append the new call description to the old making sure that the old ends with +a new line. diff --git a/logcall/__init__.py b/logcall/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/logcall/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/logcall/__openerp__.py b/logcall/__openerp__.py new file mode 100644 index 0000000..49dffcc --- /dev/null +++ b/logcall/__openerp__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Phone Log-call module for Odoo/OpenERP +# Copyright (C) 2016 credativ Ltd (). +# Copyright (C) 2016 Trever L. Adams +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Phone Log-call', + 'version': '9.0.0.1.0', + 'category': 'Phone', + 'license': 'AGPL-3', + 'summary': 'Allow a call to be logged in Odoo', + 'author': "credativ Ltd,Odoo Community Association (OCA)", + 'website': 'http://www.credativ.co.uk/', + 'depends': ['base_phone', 'crm_phone'], + 'data': [ + 'security/phone_integration_security.xml', + 'security/ir.model.access.csv', + 'views/crm_phonecall_view.xml', + 'views/res_users_view.xml' + ], + 'application': True, + 'installable': True, +} diff --git a/logcall/models/__init__.py b/logcall/models/__init__.py new file mode 100644 index 0000000..ec48f5f --- /dev/null +++ b/logcall/models/__init__.py @@ -0,0 +1,2 @@ +from . import crm_phonecall + diff --git a/logcall/models/crm_phonecall.py b/logcall/models/crm_phonecall.py new file mode 100644 index 0000000..66d896a --- /dev/null +++ b/logcall/models/crm_phonecall.py @@ -0,0 +1,185 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Phone Log-call module for Odoo/OpenERP +# Copyright (C) 2016 credativ Ltd (). +# Copyright (C) 2016 Trever L. Adams +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api, _ +from datetime import datetime, timedelta +from pytz import timezone, utc +import logging + + +logger = logging.getLogger(__name__) + + +class ResUsers(models.Model): + _inherit = 'res.users' + + context_auto_log_calls = fields.Boolean( + string='Automatically Log Incoming Calls', default=True) + + +class CrmPhonecall(models.Model): + _inherit = "crm.phonecall" + + recording_id = fields.Many2one('ir.attachment', string='Call Recording', + readonly=True) + + +class PhoneCommon(models.AbstractModel): + _inherit = 'phone.common' + + @api.model + def _get_ucp_url(self): + pass + + @api.model + def log_call_and_recording(self, odoo_type, odoo_src, odoo_dst, + odoo_duration, odoo_start, odoo_filename, + odoo_uniqueid, odoo_description): + phonecall_obj = self.env['crm.phonecall'] + attach_obj = self.env['ir.attachment'] + attach_id = False + search_field = False + + caller_user, caller_external = (odoo_type == 'incoming' and + (odoo_dst, odoo_src) or + (odoo_src, odoo_dst)) + + call_name_prefix = (odoo_type == 'incoming' and "Call from %s" or + "Call to %s") + + users = self.env['res.users'].search( + [('internal_number', '=', caller_user)]) + + if not users or not users[0].context_auto_log_calls: + return False + + tz = users[0].partner_id.tz + + tz = timezone(tz) if tz else utc + odoo_start = datetime(1970, 1, 1, tzinfo=tz) + \ + timedelta(seconds=float(odoo_start)) + odoo_end = odoo_start + timedelta(seconds=float(odoo_duration)) + + phonecall_data = { + 'partner_phone': caller_external, + 'name': call_name_prefix % (caller_external,), + 'opportunity_id': False, + 'partner_id': False, + 'hr_applicant_id': False, + 'end_date': odoo_end, + 'state': 'done', + 'date': odoo_start, + 'direction': 'inbound' if odoo_type == 'incoming' else 'outbound', + 'description': odoo_description + } + + r = self.get_record_from_phone_number(caller_external) + if not r: + logger.warning("No partner found for number %s" % caller_external) + return phonecall_obj + elif r[0] == 'res.partner': + phonecall_data['partner_id'] = r[1] + search_field = 'partner_id' + if r[2]: + phonecall_data['name'] = call_name_prefix % (r[2],) + elif r[0] == 'crm.lead': + phonecall_data['opportunity_id'] = r[1] + search_field = 'opportunity_id' + if r[2]: + phonecall_data['name'] = call_name_prefix % (r[2],) + elif r[0] == 'hr.applicant': + phonecall_data['hr_applicant_id'] = r[1] + search_field = 'hr_applicant_id' + if r[2]: + phonecall_data['name'] = call_name_prefix % (r[2],) + record = self.env[r[0]].browse(r[1]) + + if users: + phonecall_data['user_id'] = users[0].id + + jitter = self._get_jitter(users[0]) + jitter_start = datetime.strftime(odoo_start - + timedelta(seconds=float(jitter)), + '%Y-%m-%d %H:%M:%S') + jitter_end = datetime.strftime(odoo_end + + timedelta(seconds=float(jitter)), + '%Y-%m-%d %H:%M:%S') + + phonecalls = phonecall_obj.search([ + ('date', '>=', jitter_start), + ('end_date', '<=', jitter_end), + (search_field, '=', r[1]), + ('user_id', '=', users[0].id), + ('direction', '=', phonecall_data['direction'])]) + + if phonecalls: + if (odoo_end.replace(tzinfo=None) < + datetime.strptime(phonecalls[0]['end_date'], + '%Y-%m-%d %H:%M:%S')): + odoo_end = \ + phonecalls[0]['end_date'].strptime('%Y-%m-%d %H:%M:%S') + if (odoo_start.replace(tzinfo=None) > + datetime.strptime(phonecalls[0]['date'], + '%Y-%m-%d %H:%M:%S')): + 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]['recording_id']: + attach_id = phonecalls[0]['recording_id'] + phonecall_id = phonecalls[0] + phonecalls[0].write({'end_date': odoo_end, 'date': odoo_start, + 'description': odoo_description, + 'recording_id': + (attach_id.id if attach_id else False)}) + else: + phonecall_id = phonecall_obj.create(phonecall_data) + + if odoo_filename and not attach_id: + base_url = self._get_ucp_url(users[0]) + ir_attachment_data = { + 'res_model': 'crm.phonecall', + 'res_id': phonecall_id.id, + 'name': phonecall_data['name'], + 'type': 'url', + 'mimetype': 'audio/wav', + 'url': base_url.format(caller_user=caller_user, + odoo_type=odoo_type, + odoo_src=odoo_src, + odoo_dst=odoo_dst, + odoo_duration=odoo_duration, + odoo_start=odoo_start, + odoo_uniqueid=odoo_uniqueid.replace('.', '_'), + odoo_filename=odoo_filename), + 'datas_fname': odoo_filename, + } + attach_id = attach_obj.create(ir_attachment_data) + phonecall_id.write({'recording_id': attach_id.id}) + + message_format = _("Recorded %s call (%%sm)." % odoo_type) + record.message_post( + body=message_format % (int(odoo_duration) / 60,), + message_type='comment', + attachment_ids=attach_id._ids) + + return phonecall_id.id diff --git a/logcall/scripts/asterisk_logcall.py b/logcall/scripts/asterisk_logcall.py new file mode 100755 index 0000000..dfd4378 --- /dev/null +++ b/logcall/scripts/asterisk_logcall.py @@ -0,0 +1,202 @@ +#! /usr/bin/python +# -*- encoding: utf-8 -*- +# Copyright (C) 2010-2015 Alexis de Lattre +# Copyright (C) 2016 credativ Ltd (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +""" + Log a call and recording within Asterisk + + This is intended to be called by a hangup handler: + + Please, note the start is seconds since EPOCH in UTC, it must be UTC. + + Example: + [from-pstn-custom] + ... + exten => _X!,n,Set(CHANNEL(hangup_handler_push)=from-pstn-hdlr,s,1(args)) + + [from-pstn-hdlr] + exten => s,1,Verbose(0, from-pstn-hdlr called) + same => n,Set(odoo_type=incoming) + same => n,Set(odoo_src=${CDR(src)}) + same => n,Set(odoo_dst=${CDR(dst)}) + same => n,Set(odoo_duration=${CDR(duration)}) + same => n,Set(odoo_start=${CDR(start)}) + same => n,Set(odoo_filename=${CDR(recordingfile)}) + same => n,Set(odoo_uniqueid=${UNIQUEID}) + same => n,AGI(/usr/local/bin/asterisk_logcall.sh,${odoo_type},${odoo_src},${odoo_dst},${odoo_duration},${odoo_start},${odoo_filename},${odoo_uniqueid}) + same => n,Return() + + To test from the CLI: +./asterisk_logcall.sh << EOF +agi_arg_1: outgoing +agi_arg_2: 875 +agi_arg_3: 01234567890 +agi_arg_4: 345 +agi_arg_5: 1234567890 +agi_arg_6: out-875-unknown-20160216-154438-1455637478.61.wav +agi_arg_7: 1455637478.61 +agi_arg_8: Description may include things like hangup cause, transfer, automated notes +EOF + +""" + +__author__ = "Craig Gowing & Alexis de Lattre " +__date__ = "February 2016" +__version__ = "0.2" + +import xmlrpclib +import sys +from optparse import OptionParser + +# Define command line options +options = [ + {'names': ('-s', '--server'), 'dest': 'server', 'type': 'string', + 'action': 'store', 'default': False, + 'help': 'DNS or IP address of the OpenERP server. Default = none ' + '(will not try to connect to OpenERP)'}, + {'names': ('-p', '--port'), 'dest': 'port', 'type': 'int', + 'action': 'store', 'default': 8069, + 'help': "Port of OpenERP's XML-RPC interface. Default = 8069"}, + {'names': ('-e', '--ssl'), 'dest': 'ssl', + 'help': "Use SSL connections instead of clear connections. " + "Default = no, use clear XML-RPC or JSON-RPC", + 'action': 'store_true', 'default': False}, + {'names': ('-j', '--jsonrpc'), 'dest': 'jsonrpc', + 'help': "Use JSON-RPC instead of the default protocol XML-RPC. " + "Default = no, use XML-RPC", + 'action': 'store_true', 'default': False}, + {'names': ('-d', '--database'), 'dest': 'database', 'type': 'string', + 'action': 'store', 'default': 'openerp', + 'help': "OpenERP database name. Default = 'openerp'"}, + {'names': ('-u', '--user-id'), 'dest': 'userid', 'type': 'int', + 'action': 'store', 'default': 2, + 'help': "OpenERP user ID to use when connecting to OpenERP in " + "XML-RPC. Default = 2"}, + {'names': ('-t', '--username'), 'dest': 'username', 'type': 'string', + 'action': 'store', 'default': 'demo', + 'help': "OpenERP username to use when connecting to OpenERP in " + "JSON-RPC. Default = demo"}, + {'names': ('-w', '--password'), 'dest': 'password', 'type': 'string', + 'action': 'store', 'default': 'demo', + 'help': "Password of the OpenERP user. Default = 'demo'"}, +] + +def stdout_write(string): + '''Wrapper on sys.stdout.write''' + sys.stdout.write(string.encode(sys.stdout.encoding or 'utf-8', 'replace')) + sys.stdout.flush() + # When we output a command, we get an answer "200 result=1" on stdin + # Purge stdin to avoid these Asterisk error messages : + # utils.c ast_carefulwrite: write() returned error: Broken pipe + sys.stdin.readline() + return True + + +def stderr_write(string): + '''Wrapper on sys.stderr.write''' + sys.stderr.write(string.encode(sys.stdout.encoding or 'utf-8', 'replace')) + sys.stdout.flush() + return True + +def main(options, arguments): + + # AGI passes parameters to the script on standard input + stdinput = {} + while 1: + input_line = sys.stdin.readline() + if not input_line: + break + line = input_line.strip() + try: + variable, value = line.split(':', 1) + except: + break + if variable[:4] != 'agi_': # All AGI parameters start with 'agi_' + stderr_write("bad stdin variable : %s\n" % variable) + continue + variable = variable.strip() + value = value.strip() + if variable and value: + stdinput[variable] = value + stderr_write("full AGI environnement :\n") + + for variable in stdinput.keys(): + stderr_write("%s = %s\n" % (variable, stdinput.get(variable))) + + odoo_type = stdinput.get('agi_arg_1', '') + odoo_src = stdinput.get('agi_arg_2', '') + odoo_dst = stdinput.get('agi_arg_3', '') + odoo_duration = stdinput.get('agi_arg_4', '') + odoo_start = stdinput.get('agi_arg_5', '') + odoo_filename = stdinput.get('agi_arg_6', '') + odoo_uniqueid = stdinput.get('agi_arg_7', '') + odoo_description = stdinput.get('agi_arg_8', '') + + method = 'log_call_and_recording' + + res = False + # Yes, this script can be used without "-s openerp_server" ! + if options.server and options.jsonrpc: + import odoorpc + proto = options.ssl and 'jsonrpc+ssl' or 'jsonrpc' + stdout_write( + 'VERBOSE "Starting %s request on OpenERP %s:%d database ' + '%s username %s"\n' % ( + proto.upper(), options.server, options.port, options.database, + options.username)) + try: + odoo = odoorpc.ODOO(options.server, proto, options.port) + odoo.login(options.database, options.username, options.password) + res = odoo.execute( + 'phone.common', 'log_call_and_recording', odoo_type, odoo_src, odoo_dst, odoo_duration, odoo_start, odoo_filename, odoo_uniqueid, odoo_description) + stdout_write('VERBOSE "Called method %s, returned %s"\n' % (method, res)) + except: + stdout_write( + 'VERBOSE "Could not connect to OpenERP in JSON-RPC"\n') + elif options.server: + proto = options.ssl and 'https' or 'http' + stdout_write( + 'VERBOSE "Starting %s XML-RPC request on OpenERP %s:%d ' + 'database %s user ID %d"\n' % ( + proto, options.server, options.port, options.database, + options.userid)) + sock = xmlrpclib.ServerProxy( + '%s://%s:%d/xmlrpc/object' + % (proto, options.server, options.port)) + try: + res = sock.execute( + options.database, options.userid, options.password, + 'phone.common', 'log_call_and_recording', odoo_type, odoo_src, odoo_dst, odoo_duration, odoo_start, odoo_filename, odoo_uniqueid, odoo_description) + stdout_write('VERBOSE "Called method %s, returned %s"\n' % (method, res)) + except: + stdout_write('VERBOSE "Could not connect to OpenERP in XML-RPC"\n') + + 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 Lattre. " + "Published under the GNU AGPL licence." + description = "This is an AGI script that sends a query to OpenERP. " + parser = OptionParser(usage=usage, epilog=epilog, description=description) + for option in options: + param = option['names'] + del option['names'] + parser.add_option(*param, **option) + options, arguments = parser.parse_args() + sys.argv[:] = arguments + main(options, arguments) diff --git a/logcall/scripts/asterisk_logcall.sh b/logcall/scripts/asterisk_logcall.sh new file mode 100755 index 0000000..5b28765 --- /dev/null +++ b/logcall/scripts/asterisk_logcall.sh @@ -0,0 +1,5 @@ +#! /bin/sh + +PATH=/usr/local/sbin:/usr/local/bin:/var/lib/asterisk/agi-bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/share/asterisk/agi-bin:. + +timeout 10s asterisk_logcall.py --server localhost --database 9.0-test --user-id 1 --password "admin" diff --git a/logcall/scripts/freeswitch_logcall.lua b/logcall/scripts/freeswitch_logcall.lua new file mode 100644 index 0000000..ef7fe9e --- /dev/null +++ b/logcall/scripts/freeswitch_logcall.lua @@ -0,0 +1,117 @@ +-- Copyright (C) 2016 Trever L. Adams +-- based on code and ideas by Craig Gowing +-- & Alexis de Lattre +-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +-- This module assumes calls start at creation not answer. +-- It works on incoming and outgoing calls. +-- See code for the line to uncomment to change this. + +-- Add the following to the appropriate places in your dialplan +-- Outbound (default dialplan, extension to extension, and anything out via gateway or via FXO: +-- +-- Inbound (public dialplan): +-- +-- + +require("xmlrpc.http") + +function GetFileName(url) + if url == nil then + return "" + end + return url:match("^.+/(.+)$") +end + +function getTransferTarget(app_data) + if app_data == nil then + return "" + end + app_data = app_data:gsub("-.?leg%s*", "") + app_data = app_data:sub(1, string.find(app_data, " "), -2) + return app_data +end + +-- Change these to meet your installation +local port=8069; +local server="localhost"; +options_database = "odoo-test" +options_userid = 1 +options_password = "testtesttest" + +-- Best not change anything below +local protocol="https" +server_string = protocol .. "://" .. server .. ":" .. port .. "/xmlrpc/2/object" + +function odoo_report_call(odoo_type, odoo_src, odoo_dst, odoo_duration, odoo_start, odoo_filename, odoo_uniqueid, odoo_description) + local ok, res = xmlrpc.http.call(server_string, 'execute', options_database, options_userid, options_password, + 'phone.common', 'log_call_and_recording', odoo_type, odoo_src, odoo_dst, odoo_duration, odoo_start, + odoo_filename, odoo_uniqueid, odoo_description) + assert(ok, string.format("XML-RPC call failed on client: %s", tostring(res))) +end + + odoo_hangupcause = env:getHeader("variable_hangup_cause") + if odoo_hangupcause == "LOSE_RACE" then + return + end + + odoo_type = env:getHeader("odoo_type") + if odoo_type == 'inbound' then + odoo_type = 'incoming' + else + odoo_type = 'outgoing' + end + if env:getHeader("Caller-RDNIS") then + redirected = true + end + name = env:getHeader("origination_caller_id_name") + if name == "Odoo Connector" then + odoo_type = 'outgoing' + end + odoo_connector = env:getHeader("odoo_connector") + if odoo_connector then + odoo_src = env:getHeader("dialed_user") + else + odoo_src = env:getHeader("Caller-Caller-ID-Number") + end + odoo_dst = env:getHeader("Caller-Destination-Number") + odoo_dst2 = env:getHeader("Other-Leg-Destination-Number") + if odoo_dst2 then + if string.len(odoo_dst) < string.len(odoo_dst2) then + odoo_dst = odoo_dst2 + end + end + if redirected and odoo_type == "outgoing" and odoo_connector == nil then + odoo_src, odoo_dst = odoo_dst, odoo_src + end + odoo_filename = env:getHeader("variable_rec_file") + odoo_uniqueid = env:getHeader("variable_uuid") + + if odoo_filename == nil then + odoo_filename = "" + else + odoo_filename = GetFileName(odoo_filename) + end + if odoo_hangupcause == nil then + odoo_hangupcause = "" + end + app_name = env:getHeader("variable_last_app") + app_data = getTransferTarget(env:getHeader("variable_last_arg")) + if app_name == "transfer" then + odoo_hangupcause = "[" .. odoo_hangupcause .. " / TRANSFERRED TO: " .. app_data .. "]" + else + odoo_hangupcause = "[" .. odoo_hangupcause .. "]" + end + + if redirected == true then + odoo_start = tonumber(env:getHeader("bridge_epoch")) + else + odoo_start = tonumber(env:getHeader("start_epoch")) +-- odoo_start = tonumber(env:getHeader("answer_epoch")) + end + local end_epoch = tonumber(env:getHeader("end_epoch")) + if odoo_start ~= nil and end_epoch ~= nil then + odoo_duration = tonumber(end_epoch) - tonumber(odoo_start) + end + +odoo_report_call(odoo_type, odoo_src, odoo_dst, tostring(odoo_duration), tostring(odoo_start), odoo_filename, odoo_uniqueid, odoo_hangupcause) diff --git a/logcall/security/ir.model.access.csv b/logcall/security/ir.model.access.csv new file mode 100644 index 0000000..829632d --- /dev/null +++ b/logcall/security/ir.model.access.csv @@ -0,0 +1,8 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +phone_system_integration_phone_common_read,Read access on phone.common for phone system integration and call logging,model_phone_common,group_phone_system_integration,1,0,0,0 +phone_system_integration_crm_phonecall_create,Create access on crm.phonecall for phone system integration and call logging,model_crm_phonecall,group_phone_system_integration,1,1,1,0 +phone_system_integration_ir_attachment_create,Create access on ir.attachment for phone system integration and call logging,base.model_ir_attachment,group_phone_system_integration,1,1,1,0 +phone_system_integration_mail.message_create,Create access on mail.message for phone system integration and call logging,mail.model_mail_message,group_phone_system_integration,1,1,1,0 +phone_system_integration_mail.message_create,Create access on mail.followers for phone system integration and call logging,mail.model_mail_followers,group_phone_system_integration,1,1,1,0 +phone_system_integration_res_partner_write,Write access on res.partner for phone system integration and call logging,base.model_res_partner,group_phone_system_integration,1,1,0,0 +phone_system_integration_crm_lead_write,Write access on crm.lead for phone system integration and call logging,sale_crm.model_crm_lead,group_phone_system_integration,1,1,0,0 diff --git a/logcall/security/phone_integration_security.xml b/logcall/security/phone_integration_security.xml new file mode 100644 index 0000000..d063058 --- /dev/null +++ b/logcall/security/phone_integration_security.xml @@ -0,0 +1,17 @@ + + + + + + + + + Phone System Integration and Logging + + + + diff --git a/logcall/views/crm_phonecall_view.xml b/logcall/views/crm_phonecall_view.xml new file mode 100644 index 0000000..b68dbcd --- /dev/null +++ b/logcall/views/crm_phonecall_view.xml @@ -0,0 +1,18 @@ + + + + + + CRM - Phonecalls Tree + crm.phonecall + + + + + + + + + + + diff --git a/logcall/views/res_users_view.xml b/logcall/views/res_users_view.xml new file mode 100644 index 0000000..8cb2ea6 --- /dev/null +++ b/logcall/views/res_users_view.xml @@ -0,0 +1,33 @@ + + + + + + + + logcall.res.users.form + res.users + + + + + + + + + + logcall.users.preferences.view + res.users + + + + + + + + + + diff --git a/partner_phone_log/README.rst b/partner_phone_log/README.rst new file mode 100644 index 0000000..3c59a9c --- /dev/null +++ b/partner_phone_log/README.rst @@ -0,0 +1,44 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +========================== +Show phonecalls on partner +========================== + +This module restores the phonecall list on the partner view. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/140/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + +Credits +======= + +Contributors +------------ + +* Ondřej Kuzník + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/partner_phone_log/__init__.py b/partner_phone_log/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/partner_phone_log/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/partner_phone_log/__openerp__.py b/partner_phone_log/__openerp__.py new file mode 100644 index 0000000..a6d19b3 --- /dev/null +++ b/partner_phone_log/__openerp__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# (c) 2016 credativ ltd. - Ondřej Kuzník +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + 'name': 'Show phonecalls on partner', + 'summary': 'Adds a phonecall log to partner', + 'version': '9.0.1.0.0', + 'category': 'Customer Relationship Management', + 'author': 'credativ ltd., ' + 'Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'depends': [ + 'crm_phone', + ], + 'data': [ + 'views/partner_view.xml', + ], + 'application': True, + 'installable': True, +} diff --git a/partner_phone_log/models/__init__.py b/partner_phone_log/models/__init__.py new file mode 100644 index 0000000..61cf8b2 --- /dev/null +++ b/partner_phone_log/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import partner diff --git a/partner_phone_log/models/partner.py b/partner_phone_log/models/partner.py new file mode 100644 index 0000000..5f45218 --- /dev/null +++ b/partner_phone_log/models/partner.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# (c) 2016 credativ ltd. - Ondřej Kuzník +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp import models, fields + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + phonecall_ids = fields.One2many('crm.phonecall', 'partner_id') diff --git a/partner_phone_log/views/partner_view.xml b/partner_phone_log/views/partner_view.xml new file mode 100644 index 0000000..e1ffaa1 --- /dev/null +++ b/partner_phone_log/views/partner_view.xml @@ -0,0 +1,30 @@ + + + + + + res.partner.type.form.inherit + res.partner + + + + + + + + + + + + + + + + + + + + + + diff --git a/partner_phone_log_logcall/README.rst b/partner_phone_log_logcall/README.rst new file mode 100644 index 0000000..42a6250 --- /dev/null +++ b/partner_phone_log_logcall/README.rst @@ -0,0 +1,44 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============================================== +Glue to show recording on partner's phonecalls +============================================== + +This module adds the recording link to partner's phonecalls + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/140/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + +Credits +======= + +Contributors +------------ + +* Ondřej Kuzník + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/partner_phone_log_logcall/__init__.py b/partner_phone_log_logcall/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/partner_phone_log_logcall/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/partner_phone_log_logcall/__openerp__.py b/partner_phone_log_logcall/__openerp__.py new file mode 100644 index 0000000..6e7d599 --- /dev/null +++ b/partner_phone_log_logcall/__openerp__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# (c) 2016 credativ ltd. - Ondřej Kuzník +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + 'name': 'Glue between asterisk_logcall and partner_phone_log', + 'summary': 'Adds a recording column', + 'version': '9.0.1.0.0', + 'category': 'Customer Relationship Management', + 'author': 'credativ ltd., ' + 'Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'depends': [ + 'logcall', + 'partner_phone_log', + ], + 'data': [ + 'security/ir.model.access.csv', + 'views/partner_view.xml', + ], + 'application': True, + 'installable': True, +} diff --git a/partner_phone_log_logcall/security/ir.model.access.csv b/partner_phone_log_logcall/security/ir.model.access.csv new file mode 100644 index 0000000..e1dd07a --- /dev/null +++ b/partner_phone_log_logcall/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +phone_system_integration_res_partner_write,Write access on res.partner for phone system integration and call logging,base.model_res_partner,logcall.group_phone_system_integration,1,1,0,0 diff --git a/partner_phone_log_logcall/views/partner_view.xml b/partner_phone_log_logcall/views/partner_view.xml new file mode 100644 index 0000000..565660e --- /dev/null +++ b/partner_phone_log_logcall/views/partner_view.xml @@ -0,0 +1,17 @@ + + + + + + res.partner.type.form.inherit + res.partner + + + + + + + + + + diff --git a/setup/hr_recruitment_phone_log/odoo_addons/hr_recruitment_phone_log b/setup/hr_recruitment_phone_log/odoo_addons/hr_recruitment_phone_log new file mode 120000 index 0000000..2d072f0 --- /dev/null +++ b/setup/hr_recruitment_phone_log/odoo_addons/hr_recruitment_phone_log @@ -0,0 +1 @@ +../../../hr_recruitment_phone_log/ \ No newline at end of file diff --git a/setup/hr_recruitment_phone_log/setup.py b/setup/hr_recruitment_phone_log/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/hr_recruitment_phone_log/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/logcall/odoo_addons/logcall b/setup/logcall/odoo_addons/logcall new file mode 120000 index 0000000..227bfc3 --- /dev/null +++ b/setup/logcall/odoo_addons/logcall @@ -0,0 +1 @@ +../../../logcall/ \ No newline at end of file diff --git a/setup/logcall/setup.py b/setup/logcall/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/logcall/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/partner_phone_log/odoo_addons/partner_phone_log b/setup/partner_phone_log/odoo_addons/partner_phone_log new file mode 120000 index 0000000..3802c58 --- /dev/null +++ b/setup/partner_phone_log/odoo_addons/partner_phone_log @@ -0,0 +1 @@ +../../../partner_phone_log \ No newline at end of file diff --git a/setup/partner_phone_log/setup.py b/setup/partner_phone_log/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/partner_phone_log/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/partner_phone_log_logcall/odoo_addons/partner_phone_log_logcall b/setup/partner_phone_log_logcall/odoo_addons/partner_phone_log_logcall new file mode 120000 index 0000000..0141412 --- /dev/null +++ b/setup/partner_phone_log_logcall/odoo_addons/partner_phone_log_logcall @@ -0,0 +1 @@ +../../../partner_phone_log_logcall/ \ No newline at end of file diff --git a/setup/partner_phone_log_logcall/setup.py b/setup/partner_phone_log_logcall/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/partner_phone_log_logcall/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)