Skip to content

Commit

Permalink
Merge 61298a3 into d0b68ad
Browse files Browse the repository at this point in the history
  • Loading branch information
dreispt committed Dec 12, 2019
2 parents d0b68ad + 61298a3 commit 5236115
Show file tree
Hide file tree
Showing 23 changed files with 999 additions and 0 deletions.
1 change: 1 addition & 0 deletions base_phone_rate/__manifest__.py
Expand Up @@ -13,6 +13,7 @@
'decimal_precision'
],
'data': [
'views/product_product.xml',
'views/phone_rate.xml',
'security/ir.model.access.csv',
'data/decimal_precision.xml',
Expand Down
1 change: 1 addition & 0 deletions base_phone_rate/models/__init__.py
@@ -1 +1,2 @@
from . import phone_rate
from . import product_product
11 changes: 11 additions & 0 deletions base_phone_rate/models/phone_rate.py
Expand Up @@ -30,3 +30,14 @@ def _onchange_state_id(self):
def _onchange_country_id(self):
if self.state_id.country_id != self.country_id:
self.state_id = False

@api.model
def get_rate_from_phonenumber(self, phonenumber):
"""Given a phone number, find the corresponding rate"""
for n in range(1, len(phonenumber)):
number = phonenumber[:n]
phonerate = self.search(
[('dial_prefix', '=ilike', number + '%')]
)
if len(phonerate) == 1:
return phonerate
11 changes: 11 additions & 0 deletions base_phone_rate/models/product_product.py
@@ -0,0 +1,11 @@
# Copyright 2019 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductProduct(models.Model):

_inherit = 'product.product'

is_international_call = fields.Boolean()
17 changes: 17 additions & 0 deletions base_phone_rate/views/product_product.xml
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 Open Source Integrators
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record model="ir.ui.view" id="product_product_form_view">
<field name="name">product.product.form (in base_phone_rate)</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="categ_id" position="after">
<field name="is_international_call" />
</field>
</field>
</record>

</odoo>
84 changes: 84 additions & 0 deletions connector_equipment_import_cdr/README.rst
@@ -0,0 +1,84 @@
==============================
Connector Equipment Import CDR
==============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fvertical--isp-lightgray.png?logo=github
:target: https://github.com/OCA/vertical-isp/tree/12.0/connector_equipment_import_cdr
:alt: OCA/vertical-isp
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/vertical-isp-12-0/vertical-isp-12-0-connector_equipment_import_cdr
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/158/12.0
:alt: Try me on Runbot

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

This module allows to import the CDR data from the Netsapiens backend as Odoo analytic lines.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/vertical-isp/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 <https://github.com/OCA/vertical-isp/issues/new?body=module:%20connector_equipment_import_cdr%0Aversion:%2012.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
~~~~~~~~~~~~

* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>

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.

.. |maintainer-wolfhall| image:: https://github.com/wolfhall.png?size=40px
:target: https://github.com/wolfhall
:alt: wolfhall
.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px
:target: https://github.com/max3903
:alt: max3903

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-wolfhall| |maintainer-max3903|

This module is part of the `OCA/vertical-isp <https://github.com/OCA/vertical-isp/tree/12.0/connector_equipment_import_cdr>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions connector_equipment_import_cdr/__init__.py
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
36 changes: 36 additions & 0 deletions connector_equipment_import_cdr/__manifest__.py
@@ -0,0 +1,36 @@
# Copyright (C) 2019, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Connector Equipment Import CDR',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'summary': 'This module allows to import the CDR data from the Netsapiens\
backend as Odoo analytic lines.',
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
"website": 'https://github.com/OCA/vertical-isp',
'depends': [
'account',
'agreement_legal_sale',
'agreement_maintenance',
'base_phone_rate',
'connector_equipment',
],
'data': [
'data/backend_equipment_cron.xml',
'security/ir.model.access.csv',
'views/agreement_serviceprofile.xml',
'views/backend_equipment_productline.xml',
'views/backend_view.xml',
],
'demo': [
'demo/product_demo.xml',
'demo/backend_equipment_productline_demo.xml',
],
'installable': True,
'development_status': 'Beta',
'maintainers': [
'wolfhall',
'max3903',
],
}
16 changes: 16 additions & 0 deletions connector_equipment_import_cdr/data/backend_equipment_cron.xml
@@ -0,0 +1,16 @@
<odoo noupdate="1">

<record id="cron_import_cdr" model="ir.cron">
<field name="name">Import CDR</field>
<field name="model_id" ref="model_backend_equipment"/>
<field name="active" eval="False" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="state">code</field>
<field name="code">model.import_cdr()</field>
</record>

</odoo>
@@ -0,0 +1,24 @@
<odoo>

<record id="demo_backend_equipment_product_line1" model="backend.equipment.product_line">
<field name="sequence">10</field>
<field name="name" ref="connector_equipment_import_cdr.demo_call_product_product_1"/>
<field name="pattern">**</field>
<field name="backend_id" ref="connector_equipment.demo_server_backend_equipment"/>
</record>

<record id="demo_backend_equipment_product_line2" model="backend.equipment.product_line">
<field name="sequence">20</field>
<field name="name" ref="connector_equipment_import_cdr.demo_call_product_product_2"/>
<field name="pattern">**</field>
<field name="backend_id" ref="connector_equipment.demo_server_backend_equipment"/>
</record>

<record id="demo_backend_equipment_product_line3" model="backend.equipment.product_line">
<field name="sequence">30</field>
<field name="name" ref="connector_equipment_import_cdr.demo_call_product_product_3"/>
<field name="pattern">**</field>
<field name="backend_id" ref="connector_equipment.demo_server_backend_equipment"/>
</record>

</odoo>
66 changes: 66 additions & 0 deletions connector_equipment_import_cdr/demo/product_demo.xml
@@ -0,0 +1,66 @@
<odoo>

<record id="product_uom_min" model="uom.uom">
<field name="name">Minute(s)</field>
<field ref="uom.uom_categ_wtime" name="category_id"/>
<field name="factor" eval="1.0"/>
<field name="uom_type">smaller</field>
</record>

<record id="demo_product_attribute_1" model="product.attribute">
<field name="name">Type</field>
<field name="sequence">1</field>
</record>

<record id="demo_product_attribute_value_1" model="product.attribute.value">
<field name="name">Domestic</field>
<field name="attribute_id" ref="demo_product_attribute_1"/>
<field name="sequence">1</field>
</record>

<record id="demo_product_attribute_value_2" model="product.attribute.value">
<field name="name">International</field>
<field name="attribute_id" ref="demo_product_attribute_1"/>
<field name="sequence">2</field>
</record>

<record id="demo_product_attribute_value_3" model="product.attribute.value">
<field name="name">Toll Free</field>
<field name="attribute_id" ref="demo_product_attribute_1"/>
<field name="sequence">3</field>
</record>

<record id="demo_product_product_template" model="product.template">
<field name="name">Call</field>
<field name="categ_id" ref="product.product_category_3"/>
<field name="type">service</field>
<field name="sale_ok">True</field>
<field name="purchase_ok">True</field>
<field name="uom_id" ref="product_uom_min"/>
<field name="uom_po_id" ref="product_uom_min"/>
</record>

<record id="demo_call_product_product_1" model="product.product">
<field name="product_tmpl_id" ref="demo_product_product_template"/>
<field name="attribute_value_ids" eval="[(6,0,[ref('connector_equipment_import_cdr.demo_product_attribute_value_1')])]"/>
</record>

<record id="demo_call_product_product_2" model="product.product">
<field name="product_tmpl_id" ref="demo_product_product_template"/>
<field name="attribute_value_ids" eval="[(6,0,[ref('connector_equipment_import_cdr.demo_product_attribute_value_2')])]"/>
<field name="is_international_call" eval="True"/>
</record>

<record id="demo_call_product_product_3" model="product.product">
<field name="product_tmpl_id" ref="demo_product_product_template"/>
<field name="attribute_value_ids" eval="[(6,0,[ref('connector_equipment_import_cdr.demo_product_attribute_value_3')])]"/>
</record>

<record id="demo_product_template_attribute_line" model="product.template.attribute.line">
<field name="product_tmpl_id" ref="demo_product_product_template"/>
<field name="attribute_id" ref="demo_product_attribute_1"/>
<field name="value_ids" eval="[(6,0,[ref('connector_equipment_import_cdr.demo_product_attribute_value_1'), ref('connector_equipment_import_cdr.demo_product_attribute_value_2'),
ref('connector_equipment_import_cdr.demo_product_attribute_value_3')])]"/>
</record>

</odoo>
5 changes: 5 additions & 0 deletions connector_equipment_import_cdr/models/__init__.py
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import backend_equipment_productline
from . import agreement_serviceprofile
from . import backend_equipment

0 comments on commit 5236115

Please sign in to comment.