Skip to content

Commit

Permalink
Merge PR #38 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed Nov 7, 2019
2 parents 2e29bbe + 9d078cf commit 86b5476
Show file tree
Hide file tree
Showing 9 changed files with 573 additions and 0 deletions.
1 change: 1 addition & 0 deletions base_phone_rate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
27 changes: 27 additions & 0 deletions base_phone_rate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2019 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Base Phone Rate',
'version': '12.0.0.1.0',
'license': 'AGPL-3',
'summary': 'Store international rates for phone call',
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
"website": 'https://github.com/OCA/vertical-isp',
'depends': [
'contacts',
'decimal_precision'
],
'data': [
'views/phone_rate.xml',
'security/ir.model.access.csv',
'data/decimal_precision.xml',
],
'installable': True,
'development_status': 'Beta',
'maintainers': [
'wolfhall',
'max3903',
'osi-scampbell',
],
}
7 changes: 7 additions & 0 deletions base_phone_rate/data/decimal_precision.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<record id="phone_rate" model="decimal.precision">
<field name="name">Phone Rate</field>
<field name="digits">5</field>
</record>
</odoo>
1 change: 1 addition & 0 deletions base_phone_rate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import phone_rate
32 changes: 32 additions & 0 deletions base_phone_rate/models/phone_rate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (C) 2019 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
from odoo.addons import decimal_precision as dp


class PhoneRate(models.Model):
_name = "phone.rate"

name = fields.Char("Name", required=True)
country_id = fields.Many2one('res.country', "Country", required=True)
state_id = fields.Many2one('res.country.state', "Country State")
dial_prefix = fields.Char("Dial Prefix", required=True)
rate = fields.Float("Rate", required=True,
digits=dp.get_precision('Phone Rate'))

_sql_constraints = [
('dial_prefix',
'unique(dial_prefix)',
'Dial Prefix on Phone Rate must be unique!')
]

@api.onchange('state_id')
def _onchange_state_id(self):
if self.state_id:
self.country_id = self.state_id.country_id

@api.onchange('country_id')
def _onchange_country_id(self):
if self.state_id.country_id != self.country_id:
self.state_id = False
3 changes: 3 additions & 0 deletions base_phone_rate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_phone_rate_user,phone.rate.user,model_phone_rate,base.group_user,1,0,0,0
access_phone_rate_system,phone.rate.system,model_phone_rate,base.group_system,1,1,1,1
Binary file added base_phone_rate/static/description/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 86b5476

Please sign in to comment.