1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
26 sms_send_form = '''<?xml version="1.0"?>
28 <separator string="%s" colspan="4"/>
29 <field name="app_id"/>
32 <field name="password"/>
34 <field name="text" colspan="4"/>
35 </form>''' % ('SMS - Gateway: clickatell','Bulk SMS send')
38 'app_id': {'string':'API ID', 'type':'char', 'required':True},
39 'user': {'string':'Login', 'type':'char', 'required':True},
40 'password': {'string':'Password', 'type':'char', 'required':True},
41 'text': {'string':'SMS Message', 'type':'text', 'required':True}
44 def _sms_send(self, cr, uid, data, context):
45 service = netsvc.LocalService("object_proxy")
47 res_ids = service.execute(cr.dbname, uid, 'res.partner.address', 'search', [('partner_id','in',data['ids']),('type','=','default')])
48 res = service.execute(cr.dbname, uid, 'res.partner.address', 'read', res_ids, ['mobile'])
54 tools.sms_send(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
56 return {'sms_sent': nbr}
58 class part_sms(wizard.interface):
62 'result': {'type': 'form', 'arch':sms_send_form, 'fields': sms_send_fields, 'state':[('end','Cancel'), ('send','Send SMS')]}
65 'actions': [_sms_send],
66 'result': {'type': 'state', 'state':'end'}
69 part_sms('res.partner.sms_send')
73 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: