-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by dreispt
- Loading branch information
Showing
9 changed files
with
573 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import phone_rate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.