[IMP]: marketing_campaign: Improvement in view of Activity,

* Changes for paper => report

bzr revid: rpa@tinyerp.com-20100825121247-uxq7kc58mm3c1ty3
This commit is contained in:
rpa (Open ERP) 2010-08-25 17:42:47 +05:30
parent a52927fbea
commit 090d33f0de
3 changed files with 40 additions and 33 deletions

View File

@ -325,8 +325,8 @@ class marketing_campaign_activity(osv.osv):
_action_types = [
('email', 'E-mail'),
('paper', 'Paper'),
('action', 'Action'),
('report', 'Report'),
('action', 'Custom Action'),
# TODO implement the subcampaigns.
# TODO implement the subcampaign out. disallow out transitions from
# subcampaign activities ?
@ -346,13 +346,17 @@ class marketing_campaign_activity(osv.osv):
"The expression may use the following [browsable] variables:\n"
" - activity: the campaign activity\n"
" - workitem: the campaign workitem\n"
" - object: the object this campaign item represents\n"
" - resource: the resource object this campaign item represents\n"
" - transitions: list of campaign transitions outgoing from this activity\n"
"...- re: Python regular expression module"),
'type': fields.selection(_action_types, 'Type', required=True,
help="Describe type of action to be performed on the Activity.Eg : Send email,Send paper.."),
'email_template_id': fields.many2one('email.template','The e-mail to send when this activity is activated'),
'report_id': fields.many2one('ir.actions.report.xml', 'The report to generate when this activity is activated', ),
help="""The type of action to execute when an item enters this activity, such as:
- Email: send an email using a predefined email template
- Report: print an existing Report defined on the resource item and save it into a specific directory
- Custom Action: execute a predefined action, e.g. to modify the fields of the resource record
"""),
'email_template_id': fields.many2one('email.template', "Email Template", help='The e-mail to send when this activity is activated'),
'report_id': fields.many2one('ir.actions.report.xml', "Report", help='The report to generate when this activity is activated', ),
'report_directory_id': fields.many2one('document.directory','Directory',
help="This folder is used to store the generated reports"),
'server_action_id': fields.many2one('ir.actions.server', string='Action',
@ -363,11 +367,11 @@ class marketing_campaign_activity(osv.osv):
'from_ids': fields.one2many('marketing.campaign.transition',
'activity_to_id',
'Previous Activities'),
'variable_cost': fields.float('Variable Cost'),
'revenue': fields.float('Revenue'),
'variable_cost': fields.float('Variable Cost', help="Set a variable cost if you consider that every campaign item that has reached this point has entailed a certain cost. You can get cost statistics in the Reporting section"),
'revenue': fields.float('Revenue', help="Set an expected revenue if you consider that every campaign item that has reached this point has generated a certain revenue. You can get revenue statistics in the Reporting section"),
'signal': fields.char('Signal', size=128,
help='An activity with a signal can be called programmatically. Be careful, the workitem is always created when a signal is sent'),
'keep_if_condition_not_met': fields.boolean('Keep as cancelled when condition not met',
'keep_if_condition_not_met': fields.boolean('Keep as cancelled',
help="By activating this option, workitems that aren't executed because the condition is not met are marked as cancelled instead of being deleted.")
}
@ -564,6 +568,7 @@ class marketing_campaign_workitem(osv.osv):
'activity': activity,
'workitem': workitem,
'object': object_id,
'resource': object_id,
'transitions': activity.to_ids,
're': re,
}
@ -688,7 +693,7 @@ class marketing_campaign_workitem(osv.osv):
wi_obj.res_id)
}
elif wi_obj.activity_id.type == 'paper':
elif wi_obj.activity_id.type == 'report':
datas = {
'ids': [wi_obj.res_id],
'model': wi_obj.object_id.model

View File

@ -235,36 +235,38 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Activities">
<field name="object_id" invisible="1"/>
<separator string="Activity Definition" colspan="4"/>
<field name="name" select="1" colspan='4' />
<field name="signal"/>
<field name="start"/>
<field name="variable_cost" select="1"/>
<group colspan='2' col='2'>
<separator string="Activity" colspan="4"/>
<field name="name" select="1" colspan='4' />
<field name="signal" groups="base.group_extended"/>
<field name="start"/>
<field name="object_id" invisible="1"/>
</group>
<group colspan='2' col='2'>
<separator string="Cost / Revenue" colspan="4"/>
<field name="variable_cost"/>
<field name="revenue"/>
</group>
<newline/>
<separator string="Action" colspan="4"/>
<group colspan='4' col='2'>
<separator string="Condition" colspan="4"/>
<field name="condition" widget="char" colspan="2"/>
<field name="keep_if_condition_not_met"/>
</group>
<group colspan='4' col='4'>
<group colspan="4" col="6">
<field name="condition" colspan="5" widget="char"/>
<group col='2'>
<field name="keep_if_condition_not_met" />
</group>
</group>
<field name="type" width='100'/>
<separator string="Action" colspan="4"/>
<field name="type"/>
<group colspan='2' col='1'>
<field name="email_template_id" attrs="{'required':[('type','=','email')], 'invisible':[('type','!=','email')]}"
context="{'default_object_name':object_id}" />
<group attrs="{'invisible':[('type','!=','paper')]}" >
<field name="report_id" attrs="{'required':[('type','=','paper')]}" context="{'object_id':object_id}"/>
<field name="report_directory_id" attrs="{'required':[('type','=','paper')]}" />
<group attrs="{'invisible':[('type','!=','report')]}" >
<field name="report_id" attrs="{'required':[('type','=','report')]}" context="{'object_id':object_id}"/>
<field name="report_directory_id" attrs="{'required':[('type','=','report')]}" />
</group>
<field name="server_action_id" attrs="{'required':[('type','=','action')],'invisible':[('type','!=','action')]}" domain="[('model_id','=',object_id)]" />
</group>
</group>
<newline/>
<group colspan="4" col="2" expand="1">
<group colspan="4" col="2">
<separator string="Transitions" colspan="2"/>
<field name="from_ids" nolabel="1" mode="tree,form" default_get="{'default_activity_to_id': active_id}">
<tree string="Incoming Transitions" editable="bottom">

View File

@ -191,7 +191,7 @@
<field name="server_action_id" ref="action_dummy"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="report_directory_id" ref="document_directory_campaign1"/>
<field name="type">paper</field>
<field name="type">report</field>
<field eval="1" name="start"/>
<field name="report_id" ref="mc_crm_lead_demo_report"/>
</record>
@ -220,7 +220,7 @@
<field name="server_action_id" ref="action_dummy"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="report_directory_id" ref="document_directory_campaign1"/>
<field name="type">paper</field>
<field name="type">report</field>
<field name="report_id" ref="mc_crm_lead_demo_report"/>
</record>