Merging server action brahcn changes to trunk
authormga@tinyerp.com <>
Wed, 10 Sep 2008 12:59:30 +0000 (18:29 +0530)
committermga@tinyerp.com <>
Wed, 10 Sep 2008 12:59:30 +0000 (18:29 +0530)
bzr revid: mga@tinyerp.com-20080910125930-j1hvnk19eg13hyte

bin/addons/base/ir/ir.xml
bin/addons/base/ir/ir_actions.py

index fd1b8ab..9b27c68 100755 (executable)
                         <page string="Email / SMS" attrs="{'invisible':[('state','=','python'),('state','=','dummy'),('state','=','trigger'), ('state','=','object_create'), ('state','=','object_write'), ('state','=','client_action'), ('state','=','other')]}">
                             <separator colspan="4" string="Email Configuration"/>
                             <field name="address" domain="[('model_id','=',model_id)]"/>
-                            <field name="message" select="2" colspan="4" widget="html_tag"/>
+                            <field name="sms" colspan="4" attrs="{'readonly':[('state','=','python'), ('state','=','email'), ('state','=','dummy'),('state','=','trigger'), ('state','=','object_create'), ('state','=','object_write'), ('state','=','client_action'), ('state','=','other')]}"/>
+                            <field name="message" select="2" colspan="4" attrs="{'readonly':[('state','=','python'), ('state','=','dummy'),('state','=','trigger'), ('state','=','object_create'), ('state','=','object_write'), ('state','=','sms'), ('state','=','client_action'), ('state','=','other')]}" />
                             <newline/>
                             <label colspan="4" string="Access all the fields related to the current object easily just by defining name of the attribute, i.e. [[partner_id.name]] for Invoice Object"/>
                         </page>
index fad22ec..f6cffc3 100755 (executable)
@@ -377,7 +377,8 @@ class actions_server(osv.osv):
         'trigger_name': fields.char('Trigger Name', size=128),
         'trigger_obj_id': fields.reference('Trigger On', selection=model_get, size=128),
         'message': fields.text('Message', translate=True),
-        'address': fields.many2one('ir.model.fields', 'Email From / SMS'),
+        'address': fields.many2one('ir.model.fields', 'Email / Mobile'),
+        'sms': fields.char('SMS', size=160, translate=True),
         'child_ids': fields.one2many('ir.actions.actions', 'parent_id', 'Others Actions'),
         'usage': fields.char('Action Usage', size=32),
         'type': fields.char('Report Type', size=32, required=True),
@@ -493,7 +494,12 @@ class actions_server(osv.osv):
                 wf_service.trg_validate(uid, model, int(id), action.trigger_name, cr)
                 
             if action.state == 'sms':
-                #TODO: Apply mearge with the field
+                #TODO: set the user and password from the system
+                # for the sms gateway user / password
+                api_id = ''
+                text = action.sms
+                to = self.get_field_value(cr, uid, str(action.message), 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))
                 else: