improved_view
bzr revid: fp@tinyerp.com-20081204235843-uwp1poxk0rinjsbu
This commit is contained in:
parent
99580094e3
commit
6f24369ba2
|
@ -1154,19 +1154,23 @@
|
||||||
<field name="trigger_name" select="2"/>
|
<field name="trigger_name" select="2"/>
|
||||||
</page>
|
</page>
|
||||||
|
|
||||||
<page string="Email / SMS" attrs="{'invisible':[('state','=','python'),('state','=','dummy'),('state','=','trigger'), ('state','=','object_create'), ('state','=','object_write'), ('state','=','client_action'), ('state','=','other')]}">
|
<page string="Action to Launch" attrs="{'invisible':[('state','!=','client_action')]}">
|
||||||
|
<field name="action_id" select="2" colspan="4"/>
|
||||||
|
</page>
|
||||||
|
|
||||||
|
<page string="Email / SMS" attrs="{'invisible':[('state','!=','sms'),('state','!=','email')]}">
|
||||||
<separator colspan="4" string="Email Configuration"/>
|
<separator colspan="4" string="Email Configuration"/>
|
||||||
<field name="address" domain="[('model_id','=',model_id)]"/>
|
<field name="address" domain="[('model_id','=',model_id)]"/>
|
||||||
<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="sms" colspan="4" attrs="{'readonly':[('state','!=','sms')]}"/>
|
||||||
<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')]}" />
|
<field name="message" select="2" colspan="4" attrs="{'readonly':[('state','!=','email')]}" />
|
||||||
<newline/>
|
<newline/>
|
||||||
<label colspan="4" string="Access all the fields related to the current object using expression in double brackets, i.e. [[ object.partner_id.name ]]" align="0.0"/>
|
<label colspan="4" string="Access all the fields related to the current object using expression in double brackets, i.e. [[ object.partner_id.name ]]" align="0.0"/>
|
||||||
</page>
|
</page>
|
||||||
|
|
||||||
<page string="Create / Write" attrs="{'invisible':[('state','=','python'),('state','=','dummy'),('state','=','trigger'), ('state','=','sms'), ('state','=','email'), ('state','=','client_action'), ('state','=','other')]}">
|
<page string="Create / Write" attrs="{'invisible':[('state','!=','object_create'),('state','!=','object_write')]}">
|
||||||
<separator colspan="4" string="Fields Mapping"/>
|
<separator colspan="4" string="Fields Mapping"/>
|
||||||
<field name="otype"/>
|
<field name="otype"/>
|
||||||
<field name="srcmodel_id" select="2" attrs="{'readonly':[('type','=','copy'),('state','=','write_create')]}"/>
|
<field name="srcmodel_id" select="2"/>
|
||||||
<field name="fields_lines" nolabel="1" select="2" colspan="4">
|
<field name="fields_lines" nolabel="1" select="2" colspan="4">
|
||||||
<tree string="Field Mappings" editable="top">
|
<tree string="Field Mappings" editable="top">
|
||||||
<field name="col1" domain="[('model_id','=',parent.srcmodel_id or parent.model_id)]"/>
|
<field name="col1" domain="[('model_id','=',parent.srcmodel_id or parent.model_id)]"/>
|
||||||
|
|
|
@ -371,6 +371,7 @@ class actions_server(osv.osv):
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Action Name', required=True, size=64),
|
'name': fields.char('Action Name', required=True, size=64),
|
||||||
'state': fields.selection([
|
'state': fields.selection([
|
||||||
|
('client_action','Client Action'),
|
||||||
('python','Python Code'),
|
('python','Python Code'),
|
||||||
('dummy','Dummy'),
|
('dummy','Dummy'),
|
||||||
('trigger','Trigger'),
|
('trigger','Trigger'),
|
||||||
|
@ -378,12 +379,12 @@ class actions_server(osv.osv):
|
||||||
('sms','SMS'),
|
('sms','SMS'),
|
||||||
('object_create','Create Object'),
|
('object_create','Create Object'),
|
||||||
('object_write','Write Object'),
|
('object_write','Write Object'),
|
||||||
('client_action','Client Action'),
|
|
||||||
('other','Others Actions'),
|
('other','Others Actions'),
|
||||||
], 'Action State', required=True, size=32, change_default=True),
|
], 'Action State', required=True, size=32),
|
||||||
'code': fields.text('Python Code'),
|
'code': fields.text('Python Code'),
|
||||||
'sequence': fields.integer('Sequence'),
|
'sequence': fields.integer('Sequence'),
|
||||||
'model_id': fields.many2one('ir.model', 'Object', required=True),
|
'model_id': fields.many2one('ir.model', 'Object', required=True),
|
||||||
|
'action_id': fields.many2one('ir.actions.actions', 'Client Action'),
|
||||||
'trigger_name': fields.char('Trigger Name', size=128),
|
'trigger_name': fields.char('Trigger Name', size=128),
|
||||||
'trigger_obj_id': fields.reference('Trigger On', selection=model_get, size=128),
|
'trigger_obj_id': fields.reference('Trigger On', selection=model_get, size=128),
|
||||||
'message': fields.text('Message', translate=True),
|
'message': fields.text('Message', translate=True),
|
||||||
|
@ -457,6 +458,10 @@ class actions_server(osv.osv):
|
||||||
def run(self, cr, uid, ids, context={}):
|
def run(self, cr, uid, ids, context={}):
|
||||||
logger = netsvc.Logger()
|
logger = netsvc.Logger()
|
||||||
for action in self.browse(cr, uid, ids, context):
|
for action in self.browse(cr, uid, ids, context):
|
||||||
|
if action.state=='client_action':
|
||||||
|
if not action.action_id:
|
||||||
|
raise osv.except_osv(_('Error'), _("Please specify an action to launch !"))
|
||||||
|
return self.pool.get(action.action_id.type).read(cr, uid, action.action_id.id, context=context)
|
||||||
if action.state=='python':
|
if action.state=='python':
|
||||||
localdict = {
|
localdict = {
|
||||||
'self': self.pool.get(action.model_id.model),
|
'self': self.pool.get(action.model_id.model),
|
||||||
|
|
Loading…
Reference in New Issue