Skip to content
Snippets Groups Projects
Commit 80d3c51f0639 authored by Florent Aide,'s avatar Florent Aide,
Browse files

First project version. This is just a stub that adds the boolean use_tracker...

First project version. This is just a stub that adds the boolean use_tracker to the marketing campaign activity and then overrides the email launching. The real work will begin now :)
parent 4e6223671259
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
##############################################################################
#
# Email marketing click & read tracker
# Copyright (C) 2011 XCG Consulting (http://www.xcg-consulting.fr/)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import marketing_campaign_tracker
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*-
##############################################################################
#
# Email marketing click & read tracker
# Copyright (C) 2011 XCG Consulting (http://www.xcg-consulting.fr/)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name" : "Marketing Campaign Tracker",
"version" : "0.1",
"depends" : ["marketing",
"document",
"email_template",
"decimal_precision",
"marketing_campaign",
],
"author" : "XCG SAS",
"category": 'Sales',
'complexity': "expert",
"description": """
This module adds a tracker capability to the marketing campaign module.
""",
'website': 'http://www.xcg-consulting.fr',
'init_xml': [],
'update_xml': [
'marketing_campaign_tracker_view.xml',
],
'demo_xml': [
],
'installable': True,
'active': False,
#'certificate' : '',
'images': [],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*-
##############################################################################
#
# Email marketing click & read tracker
# Copyright (C) 2011 XCG Consulting (http://www.xcg-consulting.fr/)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
class marketing_campaign_activity(osv.osv):
# we want to change the marketing campaign activity...
_inherit = 'marketing.campaign.activity'
# here we add a new field to the marketing campaign activity
# the use_tracker boolean will activate the tracking for URLs if is
# set to True. The default value will be False in order to avoid any
# problem with existing activities previous to this module installation.
_columns = {
'use_tracker': fields.boolean('Use Tracker')
}
# make sure our new field has a sensible default.
# see comment above the _columns definition for more
_defaults = dict(
use_tracker = False,
)
# override the _process_wi_email to replace all the URLs in the template
# body by our tracker URL and store the corresponding keys in database
def _process_wi_email(self, cr, uid, activity, workitem, context=None):
print "*"*35
print "Processing workitem for email!"
print "*"*35
return self.pool.get('email.template').generate_mail(cr, uid,
activity.email_template_id.id,
[workitem.res_id], context=context)
marketing_campaign_activity()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_marketing_campaign_activity_form" model="ir.ui.view">
<field name="name">marketing.campaign.activity.form.inherit1</field>
<field name="model">marketing.campaign.activity</field>
<field name="type">form</field>
<field name="inherit_id" ref="marketing_campaign.view_marketing_campaign_activity_form"/>
<field name="arch" type="xml">
<xpath expr="/form/group/group/field[@name='email_template_id']" position="replace">
<!-- we add our tracker tick box in the activity only if the activity type is email -->
<group attrs="{'required':[('type','=','email')], 'invisible':[('type','!=','email')]}">
<field name="email_template_id" context="{'default_object_name':object_id}" />
<field name="use_tracker" />
</group>
</xpath>
</field>
</record>
</data>
</openerp>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment