diff --git a/bin/addons/base/__openerp__.py b/bin/addons/base/__openerp__.py
index 72517183e77..531c66909ad 100644
--- a/bin/addons/base/__openerp__.py
+++ b/bin/addons/base/__openerp__.py
@@ -58,6 +58,7 @@
'res/country_view.xml',
'res/res_currency_view.xml',
'res/partner/crm_view.xml',
+ 'res/partner/wizard/partner_sms_send_view.xml',
'res/partner/partner_data.xml',
'res/ir_property_view.xml',
'security/base_security.xml',
diff --git a/bin/addons/base/res/partner/partner.py b/bin/addons/base/res/partner/partner.py
index e5bb6a4f1cb..e3af783db98 100644
--- a/bin/addons/base/res/partner/partner.py
+++ b/bin/addons/base/res/partner/partner.py
@@ -136,6 +136,7 @@ class res_partner(osv.osv):
'supplier': fields.boolean('Supplier', help="Check this box if the partner is a supplier. If it's not checked, purchase people will not see it when encoding a purchase order."),
'city': fields.related('address', 'city', type='char', string='City'),
'phone': fields.related('address', 'phone', type='char', string='Phone'),
+ 'mobile': fields.related('address', 'mobile', type='char', string='Mobile'),
'country': fields.related('address', 'country_id', type='many2one', relation='res.country', string='Country'),
'employee': fields.boolean('Employee', help="Check this box if the partner is an Employee."),
'email': fields.related('address', 'email', type='char', size=240, string='E-mail'),
diff --git a/bin/addons/base/res/partner/partner_wizard.xml b/bin/addons/base/res/partner/partner_wizard.xml
index c064644bcf3..cc62aa9c7bc 100644
--- a/bin/addons/base/res/partner/partner_wizard.xml
+++ b/bin/addons/base/res/partner/partner_wizard.xml
@@ -1,11 +1,7 @@
-
-
+
-
+
diff --git a/bin/addons/base/res/partner/wizard/__init__.py b/bin/addons/base/res/partner/wizard/__init__.py
index b1f0addf5d4..f1a85740bf4 100644
--- a/bin/addons/base/res/partner/wizard/__init__.py
+++ b/bin/addons/base/res/partner/wizard/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL ().
#
@@ -15,14 +15,14 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
-import wizard_sms
import wizard_spam
import wizard_clear_ids
import wizard_ean_check
+import partner_sms_send
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/bin/addons/base/res/partner/wizard/partner_sms_send.py b/bin/addons/base/res/partner/wizard/partner_sms_send.py
new file mode 100644
index 00000000000..e04a3a059cf
--- /dev/null
+++ b/bin/addons/base/res/partner/wizard/partner_sms_send.py
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import tools
+from osv import fields, osv
+
+class partner_sms_send(osv.osv_memory):
+ """ Create Menu """
+
+ _name = "partner.sms.send"
+ _description = "Send SMS"
+
+ _columns = {
+ 'mobile_to': fields.char('To', size=256, required=True),
+ 'app_id': fields.char('API ID', size=256,required=True),
+ 'user': fields.char('Login', size=256,required=True),
+ 'password': fields.char('Password', size=256,required=True),
+ 'text': fields.text('SMS Message',required=True),
+ }
+
+ def default_get(self, cr, uid, fields, context=None):
+ """
+ This function gets default values
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param fields: List of fields for default value
+ @param context: A standard dictionary for contextual values
+
+ @return : default values of fields.
+ """
+ partner_pool = self.pool.get('res.partner')
+ active_ids = context and context.get('active_ids', [])
+ res = {}
+ for partner in partner_pool.browse(cr, uid, active_ids, context=context):
+ if 'mobile_to' in fields:
+ res.update({'mobile_to': partner.mobile})
+ return res
+
+ def sms_send(self, cr, uid, ids, context):
+ """
+ to send sms
+
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param ids: the ID or list of IDs
+ @param context: A standard dictionary
+ @return: number indicating the acknowledgement
+ """
+ nbr = 0
+
+ for data in self.browse(cr, uid, ids, context) :
+ tools.sms_send(
+ data.user,
+ data.password,
+ data.app_id,
+ tools.ustr(data.text),
+ data.mobile_to)
+ nbr += 1
+ return {}
+partner_sms_send()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/bin/addons/base/res/partner/wizard/partner_sms_send_view.xml b/bin/addons/base/res/partner/wizard/partner_sms_send_view.xml
new file mode 100644
index 00000000000..fafdc33d72c
--- /dev/null
+++ b/bin/addons/base/res/partner/wizard/partner_sms_send_view.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+ Send SMS
+ partner.sms.send
+ form
+
+
+
+
+
+
+
+
diff --git a/bin/addons/base/res/partner/wizard/wizard_sms.py b/bin/addons/base/res/partner/wizard/wizard_sms.py
deleted file mode 100644
index 08359386a53..00000000000
--- a/bin/addons/base/res/partner/wizard/wizard_sms.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import wizard
-import netsvc
-import tools
-
-sms_send_form = '''
-''' % ('SMS - Gateway: clickatell','Bulk SMS send')
-
-sms_send_fields = {
- 'app_id': {'string':'API ID', 'type':'char', 'required':True},
- 'user': {'string':'Login', 'type':'char', 'required':True},
- 'password': {'string':'Password', 'type':'char', 'required':True},
- 'text': {'string':'SMS Message', 'type':'text', 'required':True}
-}
-
-def _sms_send(self, cr, uid, data, context):
- service = netsvc.LocalService("object_proxy")
-
- res_ids = service.execute(cr.dbname, uid, 'res.partner.address', 'search', [('partner_id','in',data['ids']),('type','=','default')])
- res = service.execute(cr.dbname, uid, 'res.partner.address', 'read', res_ids, ['mobile'])
-
- nbr = 0
- for r in res:
- to = r['mobile']
- if to:
- tools.sms_send(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
- nbr += 1
- return {'sms_sent': nbr}
-
-class part_sms(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':sms_send_form, 'fields': sms_send_fields, 'state':[('end','Cancel'), ('send','Send SMS')]}
- },
- 'send': {
- 'actions': [_sms_send],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-part_sms('res.partner.sms_send')
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-