diff --git a/addons/marketing_campaign/__openerp__.py b/addons/marketing_campaign/__openerp__.py index 61492300c97..5f2155a07db 100644 --- a/addons/marketing_campaign/__openerp__.py +++ b/addons/marketing_campaign/__openerp__.py @@ -58,7 +58,11 @@ Note: If you need demo data, you can install the marketing_campaign_crm_demo mod "security/ir.model.access.csv" ], 'demo_xml': [ + 'marketing_campaign_demo.xml', ], + 'test': [ + 'test/marketing_campaign.yml', + ], 'installable': True, 'application': True, 'active': False, diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py index 82832134c27..2ec05d17d9b 100644 --- a/addons/marketing_campaign/marketing_campaign.py +++ b/addons/marketing_campaign/marketing_campaign.py @@ -670,7 +670,7 @@ class marketing_campaign_workitem(osv.osv): def _process_one(self, cr, uid, workitem, context=None): if workitem.state != 'todo': - return + return False activity = workitem.activity_id proxy = self.pool.get(workitem.object_id.model) @@ -707,7 +707,7 @@ class marketing_campaign_workitem(osv.osv): if result: # process _chain - workitem = workitem.browse(context)[0] # reload + workitem = workitem.browse(context=context)[0] # reload date = datetime.strptime(workitem.date, DT_FMT) for transition in activity.to_ids: @@ -784,11 +784,7 @@ class marketing_campaign_workitem(osv.osv): res = {} wi_obj = self.browse(cr, uid, ids[0], context=context) if wi_obj.activity_id.type == 'email': - data_obj = self.pool.get('ir.model.data') - data_id = data_obj._get_id(cr, uid, 'email_template', 'email_template_preview_form') - view_id = 0 - if data_id: - view_id = data_obj.browse(cr, uid, data_id, context=context).res_id + view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'email_template', 'email_template_preview_form') res = { 'name': _('Email Preview'), 'view_type': 'form', @@ -796,7 +792,7 @@ class marketing_campaign_workitem(osv.osv): 'res_model': 'email_template.preview', 'view_id': False, 'context': context, - 'views': [(view_id, 'form')], + 'views': [(view_id and view_id[1] or 0, 'form')], 'type': 'ir.actions.act_window', 'target': 'new', 'nodestroy':True, diff --git a/addons/marketing_campaign/marketing_campaign_demo.xml b/addons/marketing_campaign/marketing_campaign_demo.xml new file mode 100644 index 00000000000..df01161182e --- /dev/null +++ b/addons/marketing_campaign/marketing_campaign_demo.xml @@ -0,0 +1,93 @@ + + + + + + Template for New Partner + info@tinyerp.com + Welcome in OpenERP Partner Channel! + ${object.email or ''} + + Hello, We are very happy to send Welcome message. + + + Template for Silver Partner + info@tinyerp.com + Congratulation! You become now our Silver Partner. + ${object.email or ''} + + Hello, We are happy to announce that you now become our Silver Partner. + + + + Template for Gold Partner + info@tinyerp.com + Congratulation! You become our Gold Partner. + ${object.email or ''} + + Hello, We are happy to announce that you become our Gold Partner. + + + + + + + OpenERP Partner Channel + + active + + + + + + New Partner + + + object.credit_limit < 10000 + True + + + + Silver Partner + + object.credit_limit >= 10000 and object.credit_limit < 50000 + True + + + + + Gold Partner + object.credit_limit >= 100000 + + True + + + + + + + + + + + + + + + + + + Partners + [('name','like','agrolait')] + res.partner + + + + OpenERP Partner + create_date + + + + + + diff --git a/addons/marketing_campaign/test/marketing_campaign.yml b/addons/marketing_campaign/test/marketing_campaign.yml new file mode 100644 index 00000000000..18b3d95a911 --- /dev/null +++ b/addons/marketing_campaign/test/marketing_campaign.yml @@ -0,0 +1,114 @@ +- + In order to test process of compaign, I start compaign. +- + !workflow {model: marketing.campaign, action: state_running_set, ref: marketing_campaign_openerppartnerchannel} +- + I check the campaign on Running mode after started. +- + !assert {model: marketing.campaign, id: marketing_campaign_openerppartnerchannel}: + - state == 'running' +- + I assign segment to campaign. +- + !record {model: marketing.campaign.segment, id: marketing_campaign_segment0}: + campaign_id: marketing_campaign_openerppartnerchannel +- + I start this segment after assinged campaign. +- + !workflow {model: marketing.campaign.segment, action: state_running_set, ref: marketing_campaign_segment0} +- + I check the segment on Running mode after started. +- + !assert {model: marketing.campaign.segment, id: marketing_campaign_segment0}: + - state == 'running' +- + I synchronized segment manually to see all step of activity and process covered on this campaign. +- + !python {model: marketing.campaign.segment}: | + self.synchroniz(cr, uid, [ref("marketing_campaign_segment0")]) +- + I check followup detail of first activity. +- + !python {model: marketing.campaign.workitem}: | + ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), + ('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_0'))]) + assert ids, 'Followup item is not created for first activity.' +- + I process followup of first activity. +- + !python {model: marketing.campaign.workitem}: | + ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), + ('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_0'))]) + self.process(cr, uid, ids) + record = self.browse(cr, uid, ids)[0] + assert record.state == "done", "Followup item should be closed after process." +- + I check followup detail of second activity after process of first activity. +- + !python {model: marketing.campaign.workitem}: | + ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), + ('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_1'))]) + assert ids, 'Followup item is not created for second activity.' +- + Now I increase credit limit of customer +- + !python {model: res.partner}: | + self.write(cr, uid, [ref("base.res_partner_agrolait")], {'credit_limit':41000}, context=context) +- + I process followup of second activity after set draft. +- + !python {model: marketing.campaign.workitem}: | + ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), + ('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_1'))]) + self.button_draft(cr, uid, ids, context=context) + self.process(cr, uid, ids, context=context) + record = self.browse(cr, uid, ids[0], context=context) + assert record.state == "done", "Followup item should be closed after process." +- + I check followup detail of third activity after process of second activity. +- + !python {model: marketing.campaign.workitem}: | + ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), + ('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_2'))]) + assert ids, 'Followup item is not created for third activity.' +- + Now I increase credit limit of customer +- + !python {model: res.partner}: | + self.write(cr, uid, [ref("base.res_partner_agrolait")], {'credit_limit':151000}, context=context) +- + I process followup of third activity after set draft. +- + !python {model: marketing.campaign.workitem}: | + ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), + ('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_2'))]) + self.button_draft(cr, uid, ids, context=context) + self.process(cr, uid, ids, context=context) + record = self.browse(cr, uid, ids[0], context=context) + assert record.state == "done", "Followup item should be closed after process." +- + I print workitem report. +- + !python {model: marketing.campaign.workitem}: | + ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), + ('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_2'))]) + self.preview(cr, uid, ids) +- + I close segmentation After completion of all activity. +- + !workflow {model: marketing.campaign.segment, action: state_done_set, ref: marketing_campaign_segment0} +- + I check the segmentation is done. +- + !assert {model: marketing.campaign.segment, id: marketing_campaign_segment0}: + - state == 'done' +- + I close this campaing. +- + !workflow {model: marketing.campaign.segment, action: state_done_set, ref: marketing_campaign_openerppartnerchannel} +- + I check the campaing is done. +- + !assert {model: marketing.campaign.segment, id: marketing_campaign_openerppartnerchannel}: + - state == 'done' + diff --git a/addons/marketing_campaign_crm_demo/marketing_campaign_demo.xml b/addons/marketing_campaign_crm_demo/marketing_campaign_demo.xml index abf29f2c011..26ea71f1618 100644 --- a/addons/marketing_campaign_crm_demo/marketing_campaign_demo.xml +++ b/addons/marketing_campaign_crm_demo/marketing_campaign_demo.xml @@ -39,7 +39,10 @@ +<<<<<<< TREE +======= +>>>>>>> MERGE-SOURCE Hello,Thanks for generous interest you have shown in the openERP.Regards,OpenERP Team, For OpenERP OnDemand Free Trial 2010 @@ -49,7 +52,10 @@ +<<<<<<< TREE +======= +>>>>>>> MERGE-SOURCE Hello,We have very good offer that might suit you. We propose you to subscribe to the OpenERP Discovery Day on May 2010. If any further information required kindly revert back. @@ -58,13 +64,20 @@ For OpenERP Discovery Day on May 2010 +<<<<<<< TREE +======= + +>>>>>>> MERGE-SOURCE Thanks for subscribing to the OpenERP Discovery Day info@tinyerp.com +<<<<<<< TREE +======= +>>>>>>> MERGE-SOURCE Hello,Thanks for showing intrest and for subscribing to the OpenERP Discovery Day. If any further information required kindly revert back. I really appreciate your co-operation on this. @@ -72,13 +85,20 @@ For OpenERP Discovery Day +<<<<<<< TREE +======= + +>>>>>>> MERGE-SOURCE Thanks for buying the OpenERP book info@tinyerp.com +<<<<<<< TREE +======= +>>>>>>> MERGE-SOURCE Hello,Thanks for showing intrest and buying the OpenERP book. If any further information required kindly revert back. I really appreciate your co-operation on this. @@ -92,7 +112,10 @@ +<<<<<<< TREE +======= +>>>>>>> MERGE-SOURCE Hello, We have very good offer that might suit you. For our gold partners,We are arranging free technical training on june,2010. If any further information required kindly revert back. @@ -107,7 +130,10 @@ +<<<<<<< TREE +======= +>>>>>>> MERGE-SOURCE Hello, We have very good offer that might suit you. For our silver partners,We are paid technical training on june,2010. If any further information required kindly revert back. @@ -122,7 +148,10 @@ +<<<<<<< TREE +======= +>>>>>>> MERGE-SOURCE Hello, We have very good offer that might suit you. For our silver partners,We are offering Gold partnership. If any further information required kindly revert back. @@ -137,7 +166,10 @@ +<<<<<<< TREE +======= +>>>>>>> MERGE-SOURCE Hello, Thanks for showing intrest and for subscribing to technical training.If any further information required kindly revert back.I really appreciate your co-operation on this. Regards,OpenERP Team, For subscribing to technical training @@ -157,6 +189,7 @@ OpenERP OnDemand Free Trial 2010 + active