Browse Source

[BACKPORT][8.0] base_sms_client

pull/137/head
Andhitia Rama 8 years ago
parent
commit
528370f321
  1. 10
      base_sms_client/__openerp__.py
  2. 29
      base_sms_client/data/sms_gateway_data.xml
  3. 4
      base_sms_client/models/server_action.py
  4. 2
      base_sms_client/models/sms_gateway.py
  5. 2
      base_sms_client/models/sms_sms.py
  6. 4
      base_sms_client/models/sms_template.py
  7. 12
      base_sms_client/security/groups.xml
  8. 36
      base_sms_client/views/server_action_view.xml
  9. 254
      base_sms_client/views/sms_gateway_view.xml
  10. 32
      base_sms_client/views/smstemplate_view.xml
  11. 2
      base_sms_client/wizard/mass_sms.py
  12. 104
      base_sms_client/wizard/mass_sms_view.xml

10
base_sms_client/__manifest__.py → base_sms_client/__openerp__.py

@ -1,15 +1,15 @@
# coding: utf-8
# Copyright (C) 2015 Sébastien BEAU <sebastien.beau@akretion.com>
# © 2011 SYLEAM (<http://syleam.fr/>)
# © 2013 Julius Network Solutions SARL <contact@julius.fr>
# Copyright 2015 Sébastien BEAU <sebastien.beau@akretion.com>
# Copyright 2011 SYLEAM (<http://syleam.fr/>)
# Copyright 2013 Julius Network Solutions SARL <contact@julius.fr>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Base Sms Client",
"version": "10.0.1.0.0",
"version": "8.0.1.0.0",
'license': 'AGPL-3',
"depends": ['mail',
"depends": ['email_template',
'base_phone',
'keychain',
],

29
base_sms_client/data/sms_gateway_data.xml

@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo noupdate="1">
<record id="ir_cron_crm_action" model="ir.cron">
<field name="name">Send SMS</field>
<field name="interval_number">1</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall">False</field>
<field name="model">sms.gateway</field>
<field name="function">_run_send_sms</field>
<field name="args">()</field>
<field name="active">False</field>
</record>
</odoo>
<openerp>
<data noupdate="1">
<record id="ir_cron_crm_action" model="ir.cron">
<field name="name">Send SMS</field>
<field name="interval_number">1</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall">False</field>
<field name="model">sms.gateway</field>
<field name="function">_run_send_sms</field>
<field name="args">()</field>
<field name="active">False</field>
</record>
</data>
</openerp>

4
base_sms_client/models/server_action.py

@ -4,7 +4,7 @@
# Copyright (C) 2015 Valentin Chemiere <valentin.chemiere@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
from openerp import models, fields
class ServerAction(models.Model):
@ -23,5 +23,5 @@ class ServerAction(models.Model):
comodel_name='sms.gateway', string='SMS Server',
help='Select the SMS Gateway configuration to use with this action.')
sms_template_id = fields.Many2one(
comodel_name='mail.template', string='SMS Template',
comodel_name='email.template', string='SMS Template',
help='Select the SMS Template configuration to use with this action.')

2
base_sms_client/models/sms_gateway.py

@ -6,7 +6,7 @@
# Copyright (C) 2015 Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
from openerp import models, fields, api
PRIORITY_LIST = [
('0', '0'),

2
base_sms_client/models/sms_sms.py

@ -6,7 +6,7 @@
# Copyright (C) 2015 Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api, _
from openerp import models, fields, api, _
import logging
_logger = logging.getLogger(__name__)

4
base_sms_client/models/sms_template.py

@ -5,11 +5,11 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
from openerp import models, fields
class MailTemplate(models.Model):
_inherit = "mail.template"
_inherit = "email.template"
sms_template = fields.Boolean('SMS Template')
mobile_to = fields.Char('To (Mobile)')

12
base_sms_client/security/groups.xml

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="group_sms_user" model="res.groups">
<field name="name">SMS / User</field>
</record>
</odoo>
<openerp>
<data>
<record id="group_sms_user" model="res.groups">
<field name="name">SMS / User</field>
</record>
</data>
</openerp>

36
base_sms_client/views/server_action_view.xml

@ -1,19 +1,21 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="view_server_statistics_graph">
<field name="model">ir.actions.server</field>
<field name="inherit_id" ref="base.view_server_action_form"/>
<field name="arch" type="xml">
<page name="code" position="after" autofocus="autofocus">
<page string="SMS" name="sms" attrs="{'invisible': [('state', '!=', 'sms')]}">
<group>
<field name="sms"/>
<field name="mobile"/>
<field name="sms_server_id" invisible="1"/>
<field name="sms_template_id" domain="[('sms_template','=',True)]" attrs="{'required':[('state','=','sms')]}"/>
</group>
</page>
<openerp>
<data>
<record model="ir.ui.view" id="view_server_statistics_graph">
<field name="model">ir.actions.server</field>
<field name="inherit_id" ref="base.view_server_action_form"/>
<field name="arch" type="xml">
<page name="code" position="after" autofocus="autofocus">
<page string="SMS" name="sms" attrs="{'invisible': [('state', '!=', 'sms')]}">
<group>
<field name="sms"/>
<field name="mobile"/>
<field name="sms_server_id" invisible="1"/>
<field name="sms_template_id" domain="[('sms_template','=',True)]" attrs="{'required':[('state','=','sms')]}"/>
</group>
</page>
</field>
</record>
</odoo>
</page>
</field>
</record>
</data>
</openerp>

254
base_sms_client/views/sms_gateway_view.xml

@ -1,140 +1,142 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="sms_gateway_form">
<field name="model">sms.gateway</field>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<form string="SMS Gateway">
<sheet>
<group col="2">
<h1><field name="name" nolabel="1" placeholder="Name" colspan="2"/></h1>
<field name="method" nolabel="1" placeholder="Method" colspan="2"/>
<field name="default_gateway"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<notebook colspan="4">
<page string="General">
<group col="4">
<field name="state"/>
<field name="from_provider"/>
<field name="url"/>
<openerp>
<data>
<record model="ir.ui.view" id="sms_gateway_form">
<field name="model">sms.gateway</field>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<form string="SMS Gateway">
<sheet>
<group col="2">
<h1><field name="name" nolabel="1" placeholder="Name" colspan="2"/></h1>
<field name="method" nolabel="1" placeholder="Method" colspan="2"/>
<field name="default_gateway"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<notebook colspan="4">
<page string="General">
<group col="4">
<field name="state"/>
<field name="from_provider"/>
<field name="url"/>
</group>
</page>
<page string="Permission">
<separator string="Access Permission"
colspan="4" />
<field name="user_ids" colspan="4" nolabel="1"/>
</page>
<page string="Additional option">
<group>
<group>
<field name="validity" />
<field name="classes"/>
<field name="deferred" />
<field name="nostop" />
</group>
</page>
<page string="Permission">
<separator string="Access Permission"
colspan="4" />
<field name="user_ids" colspan="4" nolabel="1"/>
</page>
<page string="Additional option">
<group>
<group>
<field name="validity" />
<field name="classes"/>
<field name="deferred" />
<field name="nostop" />
</group>
<group>
<field name="priority" />
<field name="coding"/>
<field name="tag"/>
<field name="char_limit"/>
</group>
<field name="priority" />
<field name="coding"/>
<field name="tag"/>
<field name="char_limit"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="sms_gateway_tree">
<field name="model">sms.gateway</field>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<tree string="SMS Gateways">
<field name="name"/>
<field name="method"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="sms_gateway_tree">
<field name="model">sms.gateway</field>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<tree string="SMS Gateways">
<field name="name"/>
<field name="method"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_sms_gateway_tree">
<field name="name">SMS Gateway</field>
<field name="res_model">sms.gateway</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="sms_gateway_tree" />
</record>
<record model="ir.actions.act_window" id="action_sms_gateway_tree">
<field name="name">SMS Gateway</field>
<field name="res_model">sms.gateway</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="sms_gateway_tree" />
</record>
<menuitem name="SMS Gateway"
id="menu_gateway_administration_sms_server"
sequence="100"
parent="base_phone.menu_config_phone"
action="action_sms_gateway_tree"/>
<menuitem name="SMS Gateway"
id="menu_gateway_administration_sms_server"
sequence="100"
parent="base_phone.menu_config_phone"
action="action_sms_gateway_tree"/>
<record model="ir.ui.view" id="sms_sms_tree">
<field name="model">sms.sms</field>
<field name="arch" type="xml">
<tree string="Sms">
<field name="create_date"/>
<field name="mobile"/>
<field name="message"/>
<field name="state"/>
<field name="gateway_id"/>
<button string="Send" states="draft" type="object" name="send"/>
<button string="Retry" states="error" type="object" name="retry"/>
<button string="Cancel" states="draft,error" type="object" name="cancel"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="sms_sms_tree">
<field name="model">sms.sms</field>
<field name="arch" type="xml">
<tree string="Sms">
<field name="create_date"/>
<field name="mobile"/>
<field name="message"/>
<field name="state"/>
<field name="gateway_id"/>
<record model="ir.ui.view" id="sms_sms_form">
<field name="model">sms.sms</field>
<field name="arch" type="xml">
<form string="Sms">
<header>
<button string="Send" states="draft" type="object" name="send"/>
<button string="Retry" states="error" type="object" name="retry"/>
<button string="Cancel" states="draft,error" type="object" name="cancel"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="sms_sms_form">
<field name="model">sms.sms</field>
<field name="arch" type="xml">
<form string="Sms">
<header>
<button string="Send" states="draft" type="object" name="send"/>
<button string="Retry" states="error" type="object" name="retry"/>
<button string="Cancel" states="draft,error" type="object" name="cancel"/>
<field name="state" widget="statusbar" statusbar_visible="draft,send"/>
</header>
<sheet>
<label for="partner_id" class="oe_edit_only"/>
<h1><field name="partner_id"/></h1>
<label for="mobile" class="oe_edit_only"/>
<h1><field name="mobile"/></h1>
<group col="4">
<field name="create_date" readonly="True"/>
<field name="gateway_id" colspan="2"/>
<field name="company_id" groups="base.group_multi_company"/>
<separator string="SMS Message" colspan="4"/>
<field name="message" colspan="4" nolabel="1"/>
<separator string="Last Error" colspan="4"/>
<field name="error" colspan="4" nolabel="1"/>
</group>
</sheet>
</form>
</field>
</record>
<field name="state" widget="statusbar" statusbar_visible="draft,send"/>
</header>
<sheet>
<label for="partner_id" class="oe_edit_only"/>
<h1><field name="partner_id"/></h1>
<label for="mobile" class="oe_edit_only"/>
<h1><field name="mobile"/></h1>
<group col="4">
<field name="create_date" readonly="True"/>
<field name="gateway_id" colspan="2"/>
<field name="company_id" groups="base.group_multi_company"/>
<separator string="SMS Message" colspan="4"/>
<field name="message" colspan="4" nolabel="1"/>
<separator string="Last Error" colspan="4"/>
<field name="error" colspan="4" nolabel="1"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_sms_sms_tree">
<field name="name">Sms</field>
<field name="res_model">sms.sms</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="sms_sms_tree" />
</record>
<record model="ir.actions.act_window" id="action_sms_sms_tree">
<field name="name">Sms</field>
<field name="res_model">sms.sms</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="sms_sms_tree" />
</record>
<menuitem name="SMS Message"
id="menu_gateway_administration_sms"
sequence="110"
parent="base_phone.menu_config_phone"
action="action_sms_sms_tree"/>
<menuitem name="SMS Message"
id="menu_gateway_administration_sms"
sequence="110"
parent="base_phone.menu_config_phone"
action="action_sms_sms_tree"/>
<act_window context="{'gateway_id': active_id}"
domain="[('gateway_id', '=', active_id)]"
id="act_sms_gateway_2_sms"
name="Sms Message"
res_model="sms.sms"
src_model="sms.gateway"/>
</odoo>
<act_window context="{'gateway_id': active_id}"
domain="[('gateway_id', '=', active_id)]"
id="act_sms_gateway_2_sms"
name="Sms Message"
res_model="sms.sms"
src_model="sms.gateway"/>
</data>
</openerp>

32
base_sms_client/views/smstemplate_view.xml

@ -1,17 +1,19 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="email_template_form">
<field name="name">mail.template.form</field>
<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"/>
</field>
<field name="lang" position="before">
<field name="sms_template"/>
<field name="gateway_id"/>
</field>
<openerp>
<data>
<record model="ir.ui.view" id="email_template_form">
<field name="name">mail.template.form</field>
<field name="model">email.template</field>
<field name="inherit_id" ref="email_template.email_template_form"/>
<field name="arch" type="xml">
<field name="email_to" position="after">
<field name="mobile_to"/>
</field>
</record>
</odoo>
<field name="lang" position="before">
<field name="sms_template"/>
<field name="gateway_id"/>
</field>
</field>
</record>
</data>
</openerp>

2
base_sms_client/wizard/mass_sms.py

@ -4,7 +4,7 @@
# Copyright (C) 2015 Valentin Chemiere <valentin.chemiere@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
from openerp import models, fields, api
class WizardMassSms(models.TransientModel):

104
base_sms_client/wizard/mass_sms_view.xml

@ -1,55 +1,57 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="view_wizard_mass_sms">
<field name="model">wizard.mass.sms</field>
<field name="arch" type="xml">
<form string="SMS Gateway - Sens SMS" version="7.0">
<group string="Gateway" colspan="4">
<field name="gateway_id"/>
</group>
<notebook>
<page string="Message">
<field name="message" colspan="4" nolabel="1"/>
<!-- TODO limit to 10 the number of partner to show -->
<field name="partner_ids" colspan="4" nolabel="1">
<tree options="{'limit': 10}">
<field name="name"/>
<field name="mobile"/>
</tree>
</field>
</page>
<page string="Additional option">
<openerp>
<data>
<record model="ir.ui.view" id="view_wizard_mass_sms">
<field name="model">wizard.mass.sms</field>
<field name="arch" type="xml">
<form string="SMS Gateway - Sens SMS" version="7.0">
<group string="Gateway" colspan="4">
<field name="gateway_id"/>
</group>
<notebook>
<page string="Message">
<field name="message" colspan="4" nolabel="1"/>
<!-- TODO limit to 10 the number of partner to show -->
<field name="partner_ids" colspan="4" nolabel="1">
<tree options="{'limit': 10}">
<field name="name"/>
<field name="mobile"/>
</tree>
</field>
</page>
<page string="Additional option">
<group>
<group>
<group>
<field name="validity"/>
<field name="classes"/>
<field name="deferred"/>
<field name="nostop"/>
</group>
<group>
<field name="priority"/>
<field name="coding"/>
<field name="tag"/>
</group>
<field name="validity"/>
<field name="classes"/>
<field name="deferred"/>
<field name="nostop"/>
</group>
</page>
</notebook>
<footer>
<button string="Send SMS" name="send" type="object"
class="oe_highlight"/>
or
<button string="Cancel" class="oe_link"
special="cancel"/>
</footer>
</form>
</field>
</record>
<group>
<field name="priority"/>
<field name="coding"/>
<field name="tag"/>
</group>
</group>
</page>
</notebook>
<footer>
<button string="Send SMS" name="send" type="object"
class="oe_highlight"/>
or
<button string="Cancel" class="oe_link"
special="cancel"/>
</footer>
</form>
</field>
</record>
<act_window name="Send an SMS"
res_model="wizard.mass.sms"
src_model="res.partner"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_wizard_mass_sms"/>
</odoo>
<act_window name="Send an SMS"
res_model="wizard.mass.sms"
src_model="res.partner"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_wizard_mass_sms"/>
</data>
</openerp>
Loading…
Cancel
Save