summaryrefslogtreecommitdiff
path: root/addons/smtpclient/wizard/sendcode.py
diff options
context:
space:
mode:
authorsbh (Open ERP) <sbh@tinyerp.com>2010-04-16 10:12:36 +0530
committersbh (Open ERP) <sbh@tinyerp.com>2010-04-16 10:12:36 +0530
commit60b45a3049e0c09fbf659c043dea3567e94d64a8 (patch)
tree4c59cfab7ad51fe8b1af550bf1cdeb2a6e945738 /addons/smtpclient/wizard/sendcode.py
parenta69a679ff9a8800f3ddf45dc92b3993ea3c7610f (diff)
parentb6b0861d84148e182a422d87b33bdc66e16694bd (diff)
[Merge]: lp:openobject-addons
bzr revid: sbh@tinyerp.com-20100416044236-ztzke56zfdp8iyra
Diffstat (limited to 'addons/smtpclient/wizard/sendcode.py')
-rw-r--r--addons/smtpclient/wizard/sendcode.py67
1 files changed, 67 insertions, 0 deletions
diff --git a/addons/smtpclient/wizard/sendcode.py b/addons/smtpclient/wizard/sendcode.py
new file mode 100644
index 00000000000..632b00265bf
--- /dev/null
+++ b/addons/smtpclient/wizard/sendcode.py
@@ -0,0 +1,67 @@
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import wizard
+import pooler
+from osv import osv
+import time
+import sys
+from tools.translate import _
+
+form = '''<?xml version="1.0"?>
+<form string="Send Code">
+ <field name="emailto" colspan="4"/>
+</form>'''
+
+fields = {
+ 'emailto': {'string': 'Email Address', 'required':True, 'size': 255 , 'type': 'char', 'help': 'Enter the address Email where you want to get the Verification Code'}
+}
+
+class sendcode(wizard.interface):
+
+ def check_code(self, cr, uid, data, context):
+ code = pooler.get_pool(cr.dbname).get('email.smtpclient').browse(cr, uid, [data['id']])[0].code
+ if code:
+ raise osv.except_osv(_('Error'), _('Verification Code Already Generated !'))
+ return {}
+
+
+ def send_code(self, cr, uid, data, context):
+ state = pooler.get_pool(cr.dbname).get('email.smtpclient').test_verify_email(cr, uid, [data['id']], data['form']['emailto'])
+ if not state:
+ raise osv.except_osv(_('Error'), _('Verification Failed. Please check the Server Configuration!'))
+
+ return {}
+
+ states = {
+ 'init': {
+ 'actions': [check_code],
+ 'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel'),('send','Send Code')]}
+ },
+ 'send': {
+ 'actions': [send_code],
+ 'result': {'type':'state', 'state':'end'}
+ }
+ }
+sendcode('email.sendcode')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+