Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] base_phone_cdr #311

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions base_phone_cdr/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
==============
Base Phone CDR
==============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ec510c031dcf39f8614be3fdcaae8d6837177255ccd70c3dc3f275c44145a2ff
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fconnector--telephony-lightgray.png?logo=github
:target: https://github.com/OCA/connector-telephony/tree/17.0/base_phone_cdr
:alt: OCA/connector-telephony
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/connector-telephony-17-0/connector-telephony-17-0-base_phone_cdr
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/connector-telephony&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds Phone CDR.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-telephony/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/connector-telephony/issues/new?body=module:%20base_phone_cdr%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Open Source Integrators

Contributors
------------

- * Chanakya Soni <[email protected]>
- * Daniel Reis <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/connector-telephony <https://github.com/OCA/connector-telephony/tree/17.0/base_phone_cdr>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions base_phone_cdr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models
17 changes: 17 additions & 0 deletions base_phone_cdr/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (C) 2024 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Base Phone CDR",
"category": "web",
"version": "17.0.1.0.0",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/connector-telephony",
"depends": ["base_phone_popup"],
"data": [
"view/phone_cdr_view.xml",
"security/ir.model.access.csv",
"view/res_users_view.xml",
"view/res_partner_view.xml",
],
"license": "AGPL-3",
}
198 changes: 198 additions & 0 deletions base_phone_cdr/i18n/base_phone_cdr.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_phone_cdr
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: base_phone_cdr
#: model_terms:ir.ui.view,arch_db:base_phone_cdr.partner_view_cdr_records
msgid "<span class=\"o_stat_text\">CDR</span>"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__guid
msgid "Call GUID"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__inbound_flag
msgid "Call Inbound flag"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__call_connect_time
msgid "Call connect time"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__call_start_time
msgid "Call start time"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__called_id
msgid "Called ID"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__called_id_name
msgid "Called ID Name"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__caller_id
msgid "Caller ID"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__caller_id_name
msgid "Caller ID Name"
msgstr ""

#. module: base_phone_cdr
#: selection:phone.cdr,state:0
msgid "Completed"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__ring_time
msgid "Compute ring time"
msgstr ""

#. module: base_phone_cdr
#: selection:phone.cdr,state:0
msgid "Connected"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model,name:base_phone_cdr.model_res_partner
msgid "Contact"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__create_uid
msgid "Created by"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__create_date
msgid "Created on"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__display_name
msgid "Display Name"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__id
msgid "ID"
msgstr ""

#. module: base_phone_cdr
#: selection:phone.cdr,inbound_flag:0
msgid "Inbound"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr____last_update
msgid "Last Modified on"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__write_uid
msgid "Last Updated by"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__write_date
msgid "Last Updated on"
msgstr ""

#. module: base_phone_cdr
#: selection:phone.cdr,state:0
msgid "Missed"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__user_id
msgid "Odoo User"
msgstr ""

#. module: base_phone_cdr
#: selection:phone.cdr,state:0
msgid "Offering"
msgstr ""

#. module: base_phone_cdr
#: selection:phone.cdr,state:0
msgid "On Hold"
msgstr ""

#. module: base_phone_cdr
#: selection:phone.cdr,inbound_flag:0
msgid "Outbound"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__partner_id
msgid "Partner"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model,name:base_phone_cdr.model_phone_cdr
#: model_terms:ir.ui.view,arch_db:base_phone_cdr.view_phone_cdr_form
#: model_terms:ir.ui.view,arch_db:base_phone_cdr.view_phone_cdr_pivot
msgid "Phone CDR"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_res_users__phone_password
msgid "Phone Password"
msgstr ""

#. module: base_phone_cdr
#: model:ir.actions.act_window,name:base_phone_cdr.phone_cdr_view_action
msgid "Phone Records"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_res_users__related_phone
msgid "Related Phone"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__state
msgid "Status"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_phone_cdr__talk_time
msgid "Talk Time"
msgstr ""

#. module: base_phone_cdr
#: model_terms:ir.ui.view,arch_db:base_phone_cdr.view_users_form_telephony_tab
msgid "Telephony Preferences"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model.fields,field_description:base_phone_cdr.field_res_partner__total_cdr_count
#: model:ir.model.fields,field_description:base_phone_cdr.field_res_users__total_cdr_count
msgid "Total CDR"
msgstr ""

#. module: base_phone_cdr
#: model:ir.model,name:base_phone_cdr.model_res_users
msgid "Users"
msgstr ""

4 changes: 4 additions & 0 deletions base_phone_cdr/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import phone_cdr
from . import res_users
from . import res_partner
82 changes: 82 additions & 0 deletions base_phone_cdr/models/phone_cdr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Copyright (C) 2024 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models


class PhoneCDR(models.Model):
_name = "phone.cdr"
_description = "Phone CDR"

@api.depends("call_start_time", "call_connect_time", "inbound_flag")
def _compute_ring_time(self):
for rec in self:
ring_time = 0.0
if rec.inbound_flag and rec.call_connect_time and rec.call_start_time:
duration = rec.call_connect_time - rec.call_start_time
ring_time = divmod(duration.total_seconds(), 3600)[0]
rec.ring_time = ring_time

@api.depends("called_id", "inbound_flag")
def _compute_odoo_user(self):
for rec in self:
user_id = False
if rec.inbound_flag:
user_id = (
self.env["res.users"]
.search(
[
("related_phone", "=", rec.called_id),
("related_phone", "!=", False),
],
limit=1,
)
.id
)
rec.user_id = user_id

guid = fields.Char("Call GUID")
inbound_flag = fields.Selection(
[("outbound", "Outbound"), ("inbound", "Inbound")], string="Call Inbound flag"
)
call_start_time = fields.Datetime("Call start time")
call_connect_time = fields.Datetime("Call connect time")
ring_time = fields.Float(compute="_compute_ring_time", string="Compute ring time")
talk_time = fields.Datetime("Talk Time")
caller_id = fields.Char("Caller ID")
caller_id_name = fields.Char("Caller ID Name")
called_id = fields.Char("Called ID")
called_id_name = fields.Char("Called ID Name")
state = fields.Selection(
[
("offering", "Offering"),
("connected", "Connected"),
("missed", "Missed"),
("on_hold", "On Hold"),
("completed", "Completed"),
],
string="Status",
default="offering",
)
user_id = fields.Many2one(
"res.users", compute="_compute_odoo_user", string="Odoo User"
)
partner_id = fields.Many2one("res.partner", string="Partner")

@api.model_create_multi
def create(self, vals_list):
phonc_cdr_rec = super().create(vals_list)
for rec in phonc_cdr_rec:
if rec.inbound_flag:
rec.partner_id = self.env["res.partner"].search(
[("phone", "=", rec.called_id), ("phone", "!=", False)], limit=1
)
return phonc_cdr_rec

def write(self, vals):
res = super().write(vals)
if vals.get("inbound_flag") or vals.get("called_id"):
for rec in self:
rec.partner_id = self.env["res.partner"].search(
[("phone", "=", rec.called_id), ("phone", "!=", False)], limit=1
)
return res
Loading
Loading