Browse Source

Mig V10 & add keychain need other module to use

pull/128/head
MonsieurB 8 years ago
parent
commit
04e1ee12c4
  1. 2
      smsclient_core/__manifest__.py
  2. 50
      smsclient_core/models/sms_gateway.py
  3. 2
      smsclient_core/models/smstemplate.py
  4. 6
      smsclient_core/views/serveraction_view.xml
  5. 6
      smsclient_core/views/sms_gateway_data.xml
  6. 6
      smsclient_core/views/sms_gateway_view.xml
  7. 4
      smsclient_core/views/smstemplate_view.xml

2
smsclient_core/__manifest__.py

@ -9,7 +9,7 @@
"name": "SMS Client Core",
"version": "10.0.1.0.0",
"depends": ["base",
"email_template",
"mail",
'base_phone',
'keychain',
],

50
smsclient_core/models/sms_gateway.py

@ -8,6 +8,7 @@
import logging
from odoo import models, fields, api, _
from functools import wraps
_logger = logging.getLogger(__name__)
@ -25,18 +26,6 @@ CLASSES_LIST = [
('3', 'Toolkit')
]
class SmsAccount(models.Model):
_inherit = 'keychain.account'
namespace = fields.Selection(
selection=[('SMS_Gateway', 'SMS Account')]
)
def _sms_init_data(self):
return {'url':"", 'login_provider': "", 'password_provider': ""}
class SMSClient(models.Model):
_name = 'sms.gateway'
_description = 'SMS Client'
@ -46,18 +35,31 @@ class SMSClient(models.Model):
return []
@api.multi
def _get_provider_conf(self):
for sms_provider in self:
global_section_name = 'sms_provider'
config_vals = {}
if serv_config.has_section(global_section_name):
config_vals.update(serv_config.items(global_section_name))
custom_section_name = '.'.join((global_section_name,
sms_provider.name))
if serv_config.has_section(custom_section_name):
config_vals.update(serv_config.items(custom_section_name))
for key in config_vals:
sms_provider[key] = config_vals[key]
def _provider_get_provider_conf(self):
for rec in self:
keychain = rec.env['keychain.account']
if rec._check_permissions:
retrieve = keychain.suspend_security().retrieve
else:
retrieve = keychain.retrieve
accounts = retrieve(
[['namespace', '=', 'SMS_Gateway%s' % rec.provider_type]])
return accounts[0]
# @api.multi
# def _get_provider_conf(self):
# for sms_provider in self:
# global_section_name = 'sms_provider'
# config_vals = {}
# if serv_config.has_section(global_section_name):
# config_vals.update(serv_config.items(global_section_name))
# custom_section_name = '.'.join((global_section_name,
# sms_provider.name))
# if serv_config.has_section(custom_section_name):
# config_vals.update(serv_config.items(custom_section_name))
# for key in config_vals:
# sms_provider[key] = config_vals[key]
name = fields.Char(string='Gateway Name', required=True)
url = fields.Char(

2
smsclient_core/models/smstemplate.py

@ -9,7 +9,7 @@ from odoo import models, fields
class email_template(models.Model):
_inherit = "email.template"
_inherit = "mail.template"
sms_template = fields.Boolean('SMS Template')
mobile_to = fields.Char('To (Mobile)')

6
smsclient_core/views/serveraction_view.xml

@ -1,6 +1,5 @@
<?xml version="1.0"?>
<openerp>
<data>
<odoo>
<record model="ir.ui.view" id="view_server_statistics_graph">
<field name="name">ir.actions.server.form.inherit</field>
<field name="model">ir.actions.server</field>
@ -18,5 +17,4 @@
</page>
</field>
</record>
</data>
</openerp>
</odoo>

6
smsclient_core/views/sms_gateway_data.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<odoo noupdate="1">
<record id="ir_cron_crm_action" model="ir.cron">
<field name="name">Send SMS</field>
<field name="interval_number">1</field>
@ -12,5 +11,4 @@
<field eval="'()'" name="args"/>
<field name="active" eval="False"/>
</record>
</data>
</openerp>
</odoo>

6
smsclient_core/views/sms_gateway_view.xml

@ -1,6 +1,5 @@
<?xml version="1.0"?>
<openerp>
<data>
<odoo>
<!-- ************************************************************** -->
<!-- ** SMS Gateway list ****************************************** -->
@ -161,5 +160,4 @@
res_model="sms.sms"
src_model="sms.gateway"/>
</data>
</openerp>
</odoo>

4
smsclient_core/views/smstemplate_view.xml

@ -7,8 +7,8 @@
<!-- ************************************************************** -->
<record model="ir.ui.view" id="email_template_form">
<field name="name">email.template.form</field>
<field name="model">email.template</field>
<field name="inherit_id" ref="email_template.email_template_form"/>
<field name="model">mail.template</field>
<field name="inherit_id" ref="mail.email_template_form"/>
<field name="arch" type="xml">
<field name="email_to" position="after">
<field name="mobile_to"/>

Loading…
Cancel
Save