Skip to content
Snippets Groups Projects
Commit 32e59fa9 authored by Xavier Manach's avatar Xavier Manach
Browse files

change tracker for multiple business unit.

for now , the business unit is noy yet calculated.
this version is for test bounce
id_bu should be calculate 'host@port/databasename'
the sample here in code is :
id_bu='vmd:8069/camp'
parent a710c8eb
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
from osv import osv, fields
from replace import insert_tracker_in_html, insert_tracker_in_text
import md5
class hooked_email_template(osv.osv):
"""overrides the base email template to hook the URL tracker
......@@ -36,6 +37,8 @@
ir_attachment = self.pool.get('ir.attachment')
template = self.browse(cr, uid, template_id, context)
values = self.generate_email(cr, uid, template_id, res_id, context=context)
## Change from original send_mail
if context.get('use_tracker', False):
# here we need to use tracker so let's do it
tracker_base = context.get('tracker_base')
......@@ -39,6 +42,10 @@
if context.get('use_tracker', False):
# here we need to use tracker so let's do it
tracker_base = context.get('tracker_base')
#### TO DO RULES FOR GENERE id_bu !!!
id_bu='vmd:8069/camp'
tracker_base+='/'+md5.md5(id_bu).hexdigest()
if values['body_text']:
values['body_text'], tracks = insert_tracker_in_text(
values['body_text'],
......@@ -55,6 +62,8 @@
# create a trackitem for each URL that is replaced
trackitem.create(cr, uid, trackvalues, context=None)
## End Change from original send_mail
#values = self.add_tracker(cr, uid, template_id, res_id, context=context)
attachments = values.pop('attachments') or {}
message_id = mail_message.create(cr, uid, values, context=context)
......
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