From fcaeacb07a8d236c9019642a6014eff3cf6035dc Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Wed, 22 Oct 2008 16:55:13 +0530 Subject: [PATCH] improve, fix few bugs related to the address bzr revid: mga@mga-laptop-20081022112513-qal40qf1jzctvji7 --- bin/addons/base/ir/ir_actions.py | 10 ++++++---- bin/addons/base/ir/wizard/create_action.py | 10 ++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index 2e3d683c27a..28715ec3656 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -501,9 +501,11 @@ class actions_server(osv.osv): if action.state == 'email': user = config['email_from'] subject = action.name - - address = self.get_field_value(cr, uid, str(action.message), action, context) - body = self.merge_message(cr, uid, action, context) + address = self.get_field_value(cr, uid, action, context) + if not address: + raise osv.except_osv(_('Error'), _("Please specify the Partner Email address !")) + + body = self.merge_message(cr, uid, str(action.message), action, context) if tools.email_send_attach(user, address, subject, body, debug=False) == True: logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (address)) @@ -522,7 +524,7 @@ class actions_server(osv.osv): # for the sms gateway user / password api_id = '' text = action.sms - to = self.get_field_value(cr, uid, str(action.message), action, context) + to = self.get_field_value(cr, uid, action, context) #TODO: Apply message mearge with the field if tools.sms_send(user, password, api_id, text, to) == True: logger.notifyChannel('sms', netsvc.LOG_INFO, 'SMS successfully send to : %s' % (action.address)) diff --git a/bin/addons/base/ir/wizard/create_action.py b/bin/addons/base/ir/wizard/create_action.py index 804fda2a1ea..8617412b3d1 100644 --- a/bin/addons/base/ir/wizard/create_action.py +++ b/bin/addons/base/ir/wizard/create_action.py @@ -38,7 +38,7 @@ action_type = ''' ''' action_type_fields = { - 'type': {'string':"Start date",'type':'selection','required':True ,'selection':[('ir.actions.report.xml','Open Report')]}, + 'type': {'string':"Select Action Type",'type':'selection','required':True ,'selection':[('ir.actions.report.xml','Open Report')]}, } report_action = ''' @@ -60,13 +60,7 @@ class create_action(wizard.interface): rpt = reports.browse(cr, uid, form['report']) - action = """ -action = { - 'type': 'ir.actions.report.xml', - 'model':'%s', - 'report_name': '%s', - 'ids': context['active_ids'], -}""" % (rpt.model, rpt.report_name) + action = """action = {"type": "ir.actions.report.xml","model":"%s","report_name": "%s","ids": context["active_ids"]}""" % (rpt.model, rpt.report_name) obj = pool.get('ir.actions.server') obj.write(cr, uid, data['ids'], {'code':action})