diff options
| author | Christophe Matthieu <chm@odoo.com> | 2015-06-10 10:42:28 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-07-10 17:00:15 +0200 |
| commit | fd5361c0f7116e951cf9e69e2d97a8ccb07ce1b6 (patch) | |
| tree | 96d765ac0ddc3738e8b6ca40d7a27ddf84e334cc /addons | |
| parent | 2868a86401cf34ab28e036c3b359673c8efe324b (diff) | |
[IMP] mass_mailing: remove depends to website. Create a website_mass_mailing bridge to add subscribe snippet into website builder. Split website_links to have link_tracker to create short and trackable URLs, and website_links to have a website layout for link_tracker and add button to share page.
Diffstat (limited to 'addons')
41 files changed, 437 insertions, 341 deletions
diff --git a/addons/link_tracker/__init__.py b/addons/link_tracker/__init__.py new file mode 100644 index 00000000000..12ce74572a7 --- /dev/null +++ b/addons/link_tracker/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +import models +import controller
\ No newline at end of file diff --git a/addons/link_tracker/__openerp__.py b/addons/link_tracker/__openerp__.py new file mode 100644 index 00000000000..46b10b27942 --- /dev/null +++ b/addons/link_tracker/__openerp__.py @@ -0,0 +1,15 @@ +{ + 'name': 'Link Tracker', + 'category': 'Hidden', + 'description': """ +Create short and trackable URLs. +===================================================== + + """, + 'version': '1.0', + 'depends': ['marketing', 'utm'], + 'data': [ + 'views/link_tracker.xml', + 'security/ir.model.access.csv', + ], +} diff --git a/addons/website_links/models/__init__.py b/addons/link_tracker/controller/__init__.py index b49461a2eb5..a84d81a791b 100644 --- a/addons/website_links/models/__init__.py +++ b/addons/link_tracker/controller/__init__.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -import website_links
\ No newline at end of file +import main diff --git a/addons/link_tracker/controller/main.py b/addons/link_tracker/controller/main.py new file mode 100644 index 00000000000..1d7707fb65a --- /dev/null +++ b/addons/link_tracker/controller/main.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +import werkzeug + +from openerp.addons.web import http +from openerp.http import request + + +class link_tracker(http.Controller): + @http.route('/r/<string:code>', type='http', auth='none', website=True) + def full_url_redirect(self, code, **post): + request.env['link.tracker.click'].add_click(code, request.httprequest.remote_addr, request.session['geoip'].get('country_code'), stat_id=False) + redirect_url = request.env['link.tracker'].get_url_from_code(code) + return werkzeug.utils.redirect(redirect_url or '', 301) diff --git a/addons/link_tracker/models/__init__.py b/addons/link_tracker/models/__init__.py new file mode 100644 index 00000000000..32330efefd5 --- /dev/null +++ b/addons/link_tracker/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +import link_tracker diff --git a/addons/website_links/models/website_links.py b/addons/link_tracker/models/link_tracker.py index 99148d1ae71..591804304b9 100644 --- a/addons/website_links/models/website_links.py +++ b/addons/link_tracker/models/link_tracker.py @@ -21,12 +21,13 @@ def VALIDATE_URL(url): return url -class website_links(models.Model): - """website_links allow users to wrap any URL into a short and trackable URL - via a frontend and backend interface. website_links counts clicks on each tracked link. +class link_tracker(models.Model): + """link_tracker allow users to wrap any URL into a short and trackable URL. + link_tracker counts clicks on each tracked link. This module is also used by mass_mailing, where each link in mail_mail html_body are converted into a trackable link to get the click-through rate of each mass_mailing.""" - _name = "website.links" + + _name = "link.tracker" _rec_name = "short_url" _inherit = ['utm.mixin'] @@ -34,10 +35,10 @@ class website_links(models.Model): url = fields.Char(string='Target URL', required=True) count = fields.Integer(string='Number of Clicks', compute='_compute_count', store=True) short_url = fields.Char(string='Tracked URL', compute='_compute_short_url') - link_click_ids = fields.One2many('website.links.click', 'link_id', string='Clicks') + link_click_ids = fields.One2many('link.tracker.click', 'link_id', string='Clicks') title = fields.Char(string='Page Title', store=True) favicon = fields.Char(string='Favicon', compute='_compute_favicon', store=True) - link_code_ids = fields.One2many('website.links.code', 'link_id', string='Codes') + link_code_ids = fields.One2many('link.tracker.code', 'link_id', string='Codes') code = fields.Char(string='Short URL code', compute='_compute_code') redirected_url = fields.Char(string='Redirected URL', compute='_compute_redirected_url') short_url_host = fields.Char(string='Host of the short URL', compute='_compute_short_url_host') @@ -81,7 +82,7 @@ class website_links(models.Model): @api.one def _compute_code(self): - record = self.env['website.links.code'].search([('link_id', '=', self.id)], limit=1, order='id DESC') + record = self.env['link.tracker.code'].search([('link_id', '=', self.id)], limit=1, order='id DESC') self.code = record.code @api.one @@ -127,7 +128,7 @@ class website_links(models.Model): @api.multi def action_view_statistics(self): - action = self.env['ir.actions.act_window'].for_xml_id('website_links', 'action_view_click_statistics') + action = self.env['ir.actions.act_window'].for_xml_id('link_tracker', 'action_view_click_statistics') action['domain'] = [('link_id', '=', self.id)] return action @@ -177,16 +178,16 @@ class website_links(models.Model): if fname not in create_vals: create_vals[fname] = False - link = super(website_links, self).create(create_vals) + link = super(link_tracker, self).create(create_vals) - code = self.env['website.links.code'].get_random_code_string() - self.env['website.links.code'].create({'code': code, 'link_id': link.id}) + code = self.env['link.tracker.code'].get_random_code_string() + self.env['link.tracker.code'].create({'code': code, 'link_id': link.id}) return link @api.model def get_url_from_code(self, code, context=None): - code_rec = self.env['website.links.code'].sudo().search([('code', '=', code)]) + code_rec = self.env['link.tracker.code'].sudo().search([('code', '=', code)]) if not code_rec: return None @@ -198,11 +199,11 @@ class website_links(models.Model): ] -class website_links_code(models.Model): - _name = "website.links.code" +class link_tracker_code(models.Model): + _name = "link.tracker.code" code = fields.Char(string='Short URL Code', store=True) - link_id = fields.Many2one('website.links', 'Link', required=True, ondelete='cascade') + link_id = fields.Many2one('link.tracker', 'Link', required=True, ondelete='cascade') @api.model def get_random_code_string(self): @@ -220,19 +221,19 @@ class website_links_code(models.Model): ] -class website_links_click(models.Model): - _name = "website.links.click" +class link_tracker_click(models.Model): + _name = "link.tracker.click" _rec_name = "link_id" click_date = fields.Date(string='Create Date') - link_id = fields.Many2one('website.links', 'Link', required=True, ondelete='cascade') + link_id = fields.Many2one('link.tracker', 'Link', required=True, ondelete='cascade') ip = fields.Char(string='Internet Protocol') country_id = fields.Many2one('res.country', 'Country') @api.model def add_click(self, code, ip, country_code, stat_id=False): self = self.sudo() - code_rec = self.env['website.links.code'].search([('code', '=', code)]) + code_rec = self.env['link.tracker.code'].search([('code', '=', code)]) if not code_rec: return None diff --git a/addons/link_tracker/security/ir.model.access.csv b/addons/link_tracker/security/ir.model.access.csv new file mode 100644 index 00000000000..847be6ce162 --- /dev/null +++ b/addons/link_tracker/security/ir.model.access.csv @@ -0,0 +1,10 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_link_tracker_user,link.tracker,model_link_tracker,base.group_user,1,0,0,0 +access_link_tracker_manager,link.tracker,model_link_tracker,marketing.group_marketing_user,1,1,1,1 +access_link_tracker_public,link.tracker,model_link_tracker,base.group_public,1,0,0,0 +access_link_tracker_code_user,link.tracker.code,model_link_tracker_code,base.group_user,1,0,0,0 +access_link_tracker_code_manager,link.tracker.code,model_link_tracker_code,marketing.group_marketing_user,1,1,1,1 +access_link_tracker_code_public,link.tracker.code,model_link_tracker_code,base.group_public,1,0,0,0 +access_link_tracker_click_user,link.tracker.click,model_link_tracker_click,base.group_user,1,0,0,0 +access_link_tracker_click_manager,link.tracker.click,model_link_tracker_click,marketing.group_marketing_user,1,1,1,1 +access_link_tracker_click_public,link.tracker.click,model_link_tracker_click,base.group_public,1,0,0,0 diff --git a/addons/website_links/views/website_links.xml b/addons/link_tracker/views/link_tracker.xml index 8616019de41..ec78e86a1b8 100644 --- a/addons/website_links/views/website_links.xml +++ b/addons/link_tracker/views/link_tracker.xml @@ -3,15 +3,15 @@ <data> <record model="ir.actions.act_window" id="action_view_click_statistics"> <field name="name">Statistics of Clicks</field> - <field name="res_model">website.links.click</field> + <field name="res_model">link.tracker.click</field> <field name="view_mode">graph</field> <field name="domain">[('link_id', 'IN', ids)]</field> </record> <!-- Search --> - <record id="view_website_links_filter" model="ir.ui.view"> + <record id="view_link_tracker_filter" model="ir.ui.view"> <field name="name">Links</field> - <field name="model">website.links</field> + <field name="model">link.tracker</field> <field name="arch" type="xml"> <search string="Tracked Link"> <field name="title"/> @@ -21,9 +21,9 @@ </record> <!-- Website links views --> - <record id="view_website_links_form" model="ir.ui.view"> - <field name="name">website.links.form</field> - <field name="model">website.links</field> + <record id="view_link_tracker_form" model="ir.ui.view"> + <field name="name">link.tracker.form</field> + <field name="model">link.tracker</field> <field name="arch" type="xml"> <form string="Website Link"> <sheet> @@ -53,9 +53,9 @@ </record> - <record id="view_website_links_form_stats" model="ir.ui.view"> - <field name="name">website.links.my.form</field> - <field name="model">website.links</field> + <record id="view_link_tracker_form_stats" model="ir.ui.view"> + <field name="name">link.tracker.my.form</field> + <field name="model">link.tracker</field> <field name="arch" type="xml"> <form string="Website Link Graph"> <sheet> @@ -71,17 +71,17 @@ </field> </record> - <record model="ir.actions.act_window" id="action_website_links_stats"> - <field name="name">website.links.form.graph.action</field> - <field name="res_model">website.links</field> + <record model="ir.actions.act_window" id="action_link_tracker_stats"> + <field name="name">link.tracker.form.graph.action</field> + <field name="res_model">link.tracker</field> <field name="view_type">form</field> <field name="view_mode">form</field> - <field name="view_id" ref="view_website_links_form_stats"/> + <field name="view_id" ref="view_link_tracker_form_stats"/> </record> - <record id="view_website_links_tree" model="ir.ui.view"> - <field name="name">website.links.tree</field> - <field name="model">website.links</field> + <record id="view_link_tracker_tree" model="ir.ui.view"> + <field name="name">link.tracker.tree</field> + <field name="model">link.tracker</field> <field name="arch" type="xml"> <tree string="Website Links"> <field name="create_date"/> @@ -93,9 +93,9 @@ </field> </record> - <record id="view_website_links_graph" model="ir.ui.view" > - <field name="name">website.links.graph</field> - <field name="model">website.links</field> + <record id="view_link_tracker_graph" model="ir.ui.view" > + <field name="name">link.tracker.graph</field> + <field name="model">link.tracker</field> <field name="arch" type="xml"> <graph string="Website Links" type="bar"> <field name="url" type="row"/> @@ -105,17 +105,17 @@ </record> <!-- Action for website links--> - <record model="ir.actions.act_window" id="action_website_links"> + <record model="ir.actions.act_window" id="action_link_tracker"> <field name="name">Link Tracker</field> - <field name="res_model">website.links</field> + <field name="res_model">link.tracker</field> <field name="view_type">form</field> <field name="view_mode">tree,form,graph</field> </record> <!-- Website links click views --> - <record id="view_website_links_click_form" model="ir.ui.view"> - <field name="name">website.links.click.form</field> - <field name="model">website.links.click</field> + <record id="view_link_tracker_click_form" model="ir.ui.view"> + <field name="name">link.tracker.click.form</field> + <field name="model">link.tracker.click</field> <field name="arch" type="xml"> <form string="Website Link Clicks"> <header> @@ -131,9 +131,9 @@ </field> </record> - <record id="view_website_links_click_tree" model="ir.ui.view"> - <field name="name">website.links.click.tree</field> - <field name="model">website.links.click</field> + <record id="view_link_tracker_click_tree" model="ir.ui.view"> + <field name="name">link.tracker.click.tree</field> + <field name="model">link.tracker.click</field> <field name="arch" type="xml"> <tree string="Website Links Clicks"> <field name="link_id"/> @@ -143,9 +143,9 @@ </field> </record> - <record id="view_website_links_click_graph" model="ir.ui.view" > - <field name="name">website.links.click.graph</field> - <field name="model">website.links.click</field> + <record id="view_link_tracker_click_graph" model="ir.ui.view" > + <field name="name">link.tracker.click.graph</field> + <field name="model">link.tracker.click</field> <field name="arch" type="xml"> <graph string="Website Link Clicks"> <field name="link_id"/> @@ -156,14 +156,14 @@ </record> <!-- Action for website links click--> - <record model="ir.actions.act_window" id="action_website_links_click"> + <record model="ir.actions.act_window" id="action_link_tracker_click"> <field name="name">Tracked Links</field> - <field name="res_model">website.links.click</field> + <field name="res_model">link.tracker.click</field> <field name="view_type">form</field> <field name="view_mode">graph,tree,form</field> </record> <menuitem id="menu_url_shortener_main" name="Link Tracker" parent="utm.menu_link_tracker_root" groups="base.group_no_one"/> - <menuitem id="menu_url_shortener_links" name="Tracked Links" parent="menu_url_shortener_main" action="action_website_links"/> + <menuitem id="menu_url_shortener_links" name="Tracked Links" parent="menu_url_shortener_main" action="action_link_tracker"/> </data> </openerp> diff --git a/addons/mass_mailing/__openerp__.py b/addons/mass_mailing/__openerp__.py index 0d9a32c20db..f20cfe6e91c 100644 --- a/addons/mass_mailing/__openerp__.py +++ b/addons/mass_mailing/__openerp__.py @@ -16,9 +16,10 @@ professional emails and reuse templates in a few clicks. 'depends': [ 'mail', 'marketing', - 'web_kanban_gauge', - 'website_links', 'utm', + 'link_tracker', + 'web_editor', + 'web_kanban_gauge', ], 'data': [ 'data/mail_data.xml', @@ -29,11 +30,8 @@ professional emails and reuse templates in a few clicks. 'views/mass_mailing.xml', 'views/res_config.xml', 'views/email_template.xml', - 'views/website_mass_mailing.xml', 'security/ir.model.access.csv', 'views/mass_mailing.xml', - 'views/unsubscribe.xml', - 'views/snippets.xml', 'views/editor_field_html.xml', 'views/snippets_themes.xml', 'views/snippets_themes_options.xml', diff --git a/addons/mass_mailing/controllers/main.py b/addons/mass_mailing/controllers/main.py index 2a86ceaaef6..035d22ef09d 100644 --- a/addons/mass_mailing/controllers/main.py +++ b/addons/mass_mailing/controllers/main.py @@ -19,70 +19,8 @@ class MassMailController(http.Controller): return response - @http.route(['/mail/mailing/<int:mailing_id>/unsubscribe'], type='http', website=True, auth='none') - def mailing(self, mailing_id, email=None, res_id=None, **post): - mailing = request.env['mail.mass_mailing'].sudo().browse(mailing_id) - if mailing.exists(): - if mailing.mailing_model == 'mail.mass_mailing.contact': - contacts =request.env['mail.mass_mailing.contact'].sudo().search([('email', 'ilike', email)]) - return request.website.render('mass_mailing.page_unsubscribe', {'contacts': contacts, 'email': email, 'mailing_id':mailing_id}) - else: - mailing.update_opt_out(mailing_id, email, [res_id], True) - return request.website.render('mass_mailing.page_unsubscribed') - - @http.route(['/mail/mailing/unsubscribe'], type='json', auth='none') - def unsubscribe(self, mailing_id, opt_in_ids, opt_out_ids, email): - mailing = request.env['mail.mass_mailing'].sudo().browse(mailing_id) - if mailing.exists(): - mailing.update_opt_out(mailing_id, email, opt_in_ids, False) - mailing.update_opt_out(mailing_id, email, opt_out_ids, True) - - @http.route('/website_mass_mailing/is_subscriber', type='json', website=True, auth="public") - def is_subscriber(self, list_id, **post): - cr, uid, context = request.cr, request.uid, request.context - Contacts = request.registry['mail.mass_mailing.contact'] - Users = request.registry['res.users'] - - is_subscriber = False - email = None - if uid != request.website.user_id.id: - email = Users.browse(cr, SUPERUSER_ID, uid, context).email - elif request.session.get('mass_mailing_email'): - email = request.session['mass_mailing_email'] - - if email: - contact_ids = Contacts.search(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email), ('opt_out', '=', False)], context=context) - is_subscriber = len(contact_ids) > 0 - - return {'is_subscriber': is_subscriber, 'email': email} - - @http.route('/website_mass_mailing/subscribe', type='json', auth="public") - def subscribe(self, list_id, email, **post): - cr, uid, context = request.cr, request.uid, request.context - Contacts = request.registry['mail.mass_mailing.contact'] - - contact_ids = Contacts.search_read(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email)], ['opt_out'], context=context) - if not contact_ids: - Contacts.add_to_list(cr, SUPERUSER_ID, email, int(list_id), context=context) - else: - if contact_ids[0]['opt_out']: - Contacts.write(cr, SUPERUSER_ID, [contact_ids[0]['id']], {'opt_out': False}, context=context) - # add email to session - request.session['mass_mailing_email'] = email - return True - @http.route('/r/<string:code>/m/<int:stat_id>', type='http', auth="none") def full_url_redirect(self, code, stat_id, **post): cr, uid, context = request.cr, request.uid, request.context - request.registry['website.links.click'].add_click(cr, uid, code, request.httprequest.remote_addr, request.session['geoip'].get('country_code'), stat_id=stat_id, context=context) - return werkzeug.utils.redirect(request.registry['website.links'].get_url_from_code(cr, uid, code, context=context), 301) - - @http.route(['/website_mass_mailing/get_content'], type='json', auth="public") - def get_mass_mailing_content(self, newsletter_id, **post): - data = self.is_subscriber(newsletter_id, **post) - mass_mailing_list = request.registry['mail.mass_mailing.list'].browse(request.cr, SUPERUSER_ID, int(newsletter_id), request.context) - data.update({ - 'content': mass_mailing_list.popup_content, - 'redirect_url': mass_mailing_list.popup_redirect_url - }) - return data + request.registry['link.tracker.click'].add_click(cr, uid, code, request.httprequest.remote_addr, request.session['geoip'].get('country_code'), stat_id=stat_id, context=context) + return werkzeug.utils.redirect(request.registry['link.tracker'].get_url_from_code(cr, uid, code, context=context), 301) diff --git a/addons/mass_mailing/controllers/web_editor.py b/addons/mass_mailing/controllers/web_editor.py index f8e3007a5ac..a9cff910c69 100644 --- a/addons/mass_mailing/controllers/web_editor.py +++ b/addons/mass_mailing/controllers/web_editor.py @@ -21,4 +21,5 @@ class Web_Editor(Web_Editor): @http.route(['/mass_mailing/snippets'], type='json', auth="user", website=True) def mass_mailing_snippets(self): - return request.registry["ir.ui.view"].render(request.cr, request.uid, 'mass_mailing.email_designer_snippets', None, context=request.context) + values = {'company_id': request.env['res.users'].browse(request.uid).company_id} + return request.registry["ir.ui.view"].render(request.cr, request.uid, 'mass_mailing.email_designer_snippets', values, context=request.context) diff --git a/addons/mass_mailing/data/mass_mailing_demo.xml b/addons/mass_mailing/data/mass_mailing_demo.xml index f58d9dc0f21..72bce71b78d 100644 --- a/addons/mass_mailing/data/mass_mailing_demo.xml +++ b/addons/mass_mailing/data/mass_mailing_demo.xml @@ -40,7 +40,7 @@ <field name="use_default_to" eval="True"/> <field name="auto_delete" eval="True"/> <field name="body_html"><![CDATA[<div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #ffffff repeat top /100%"> - <table cellpadding="0" cellspacing="0" style="border-collapse:collapse" width="100%"><tbody><tr><td style="padding:10px 10px 10px 5px" valign="center" width="270"> <a style="text-decoration:none" href="http://www.example.com"><strong class="o_default_snippet_text">Your Company</strong></a> </td><td style="padding:10px 15px 10px 10px;vertical-align:middle" valign="center" width="270"><table align="right" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse"><tbody><tr><td align="right"><a href="https://www.facebook.com/Odoo"><span class="fa fa-facebook-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-google-plus-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-linkedin-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-twitter-square fa-2x" style="color:#44B7B7;"></span></a></td></tr></tbody></table></td></tr></tbody></table></div><div style="padding:0px;width:600px;margin:auto;background-color:#44B7B7;color:#168484" class=""><table cellpadding="0" cellspacing="0" style="width:100%;background-color:inherit;border-collapse:collapse;color:inherit"><tbody><tr><td class="col_mv bg-color" style="text-align:left; padding-left:20px;vertical-align:middle;font-size:14px"><p style="margin:0;font-size:20px;color:#fff" class="o_default_snippet_text">You get a 20% discount for signing up!</p><p style="margin:0" class="o_default_snippet_text">Discount Code: <strong class="o_default_snippet_text">45A9E77DGW8455</strong></p></td><td class="col_mv bg-color" style="padding:20px;text-align:center;vertical-align:middle"> <span class="fa fa-6x fa-ticket"></span> </td></tr></tbody></table></div><div class="snippet_row bg-color" style="padding:0;width:600px;max-width:600px;margin:0 auto;background: #fff repeat top /100%;color:#168484"><table style="width:100%;text-align:justify;margin:0 auto;inherit;border-collapse:collapse;color:inherit"><tbody><tr><td style="padding:10px 30px;font-size:14px;line-height:20px"><p style="margin:0" class="o_default_snippet_text">Dear John</p><p style="margin:0" class="o_default_snippet_text">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br></p><p style="margin:0" class="o_default_snippet_text">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p><p style="margin:0" class="o_default_snippet_text">Kind Regards,</p><p style="margin:0" class="o_default_snippet_text">Michael Fletcher</p></td></tr></tbody></table></div><div style="padding:0;width:600px;max-width:600px;margin:0 auto" class=""><table style="width:100%;text-align:justify;margin:0 auto;background-color:inherit;border-collapse:collapse"><tbody><tr><td class="col_mv bg-color" style="padding:10px 0;background-color:#168484;color:#fff"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-check fa-3x"></span> </td><td style="padding-left:10px;color:#fff;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0" class="o_default_snippet_text">Step 1:</p><p style="margin:0" class="o_default_snippet_text">Place Order</p></td></tr></tbody></table></td><td class="col_mv bg-color" style="padding:10px 0;background-color:#FFFFFF;color:#808080"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-truck fa-3x"></span> </td><td style="padding-left:10px;color:#808080;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0" class="o_default_snippet_text">Step 2:</p><p style="margin:0" class="o_default_snippet_text">Shipping</p></td></tr></tbody></table></td><td class="col_mv bg-color" style="padding:10px 0;background-color:#FFFFFF;color:#808080"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-dollar fa-3x"></span> </td><td style="padding-left:10px;color:#808080;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0" class="o_default_snippet_text">Step 3:</p><p style="margin:0" class="o_default_snippet_text">Payment</p></td></tr></tbody></table></td></tr></tbody></table></div><div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #414141 repeat top /100%;color:#44B7B7"><div style="padding:10px"><table cellpadding="0" cellspacing="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit;color:inherit"><tbody><tr><td style="text-align:center"> <a style="text-decoration: none;" href="https://www.facebook.com/Odoo"><span class="fa fa-facebook-square fa-2x"></span></a><a style="text-decoration: none;" href="https://plus.google.com/+Odooapps"><span class="fa fa-google-plus-square fa-2x"></span></a><a style="text-decoration: none;" href="https://www.linkedin.com/company/odoo"><span class="fa fa-linkedin-square fa-2x"></span></a><a style="text-decoration: none;" href="https://twitter.com/Odoo"><span class="fa fa-twitter-square fa-2x"></span></a> </td></tr><tr><td style="font-size:12px;text-align:center;padding-top:10px;padding-bottom:5px" class="o_default_snippet_text"> <a href="/unsubscribe_from_list" style="color:#44B7B7" class="o_default_snippet_text">Unsubscribe</a>|<a href="/page/contactus" style="color:#44B7B7" class="o_default_snippet_text">Contact</a> </td></tr></tbody></table></div> + <table cellpadding="0" cellspacing="0" style="border-collapse:collapse" width="100%"><tbody><tr><td style="padding:10px 10px 10px 5px" valign="center" width="270"> <a style="text-decoration:none" href="http://www.example.com"><strong>Your Company</strong></a> </td><td style="padding:10px 15px 10px 10px;vertical-align:middle" valign="center" width="270"><table align="right" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse"><tbody><tr><td align="right"><a href="https://www.facebook.com/Odoo"><span class="fa fa-facebook-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-google-plus-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-linkedin-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-twitter-square fa-2x" style="color:#44B7B7;"></span></a></td></tr></tbody></table></td></tr></tbody></table></div><div style="padding:0px;width:600px;margin:auto;background-color:#44B7B7;color:#168484"><table cellpadding="0" cellspacing="0" style="width:100%;background-color:inherit;border-collapse:collapse;color:inherit"><tbody><tr><td class="col_mv bg-color" style="text-align:left; padding-left:20px;vertical-align:middle;font-size:14px"><p style="margin:0;font-size:20px;color:#fff">You get a 20% discount for signing up!</p><p style="margin:0">Discount Code: <strong>45A9E77DGW8455</strong></p></td><td class="col_mv bg-color" style="padding:20px;text-align:center;vertical-align:middle"> <span class="fa fa-6x fa-ticket"></span> </td></tr></tbody></table></div><div class="snippet_row bg-color" style="padding:0;width:600px;max-width:600px;margin:0 auto;background: #fff repeat top /100%;color:#168484"><table style="width:100%;text-align:justify;margin:0 auto;inherit;border-collapse:collapse;color:inherit"><tbody><tr><td style="padding:10px 30px;font-size:14px;line-height:20px"><p style="margin:0">Dear ${object.name}</p><p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br></p><p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p><p style="margin:0">Kind Regards,</p><p style="margin:0">Michael Fletcher</p></td></tr></tbody></table></div><div style="padding:0;width:600px;max-width:600px;margin:0 auto"><table style="width:100%;text-align:justify;margin:0 auto;background-color:inherit;border-collapse:collapse"><tbody><tr><td class="col_mv bg-color" style="padding:10px 0;background-color:#168484;color:#fff"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-check fa-3x"></span> </td><td style="padding-left:10px;color:#fff;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0">Step 1:</p><p style="margin:0">Place Order</p></td></tr></tbody></table></td><td class="col_mv bg-color" style="padding:10px 0;background-color:#FFFFFF;color:#808080"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-truck fa-3x"></span> </td><td style="padding-left:10px;color:#808080;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0">Step 2:</p><p style="margin:0">Shipping</p></td></tr></tbody></table></td><td class="col_mv bg-color" style="padding:10px 0;background-color:#FFFFFF;color:#808080"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-dollar fa-3x"></span> </td><td style="padding-left:10px;color:#808080;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0">Step 3:</p><p style="margin:0">Payment</p></td></tr></tbody></table></td></tr></tbody></table></div><div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #414141 repeat top /100%;color:#44B7B7"><div style="padding:10px"><table cellpadding="0" cellspacing="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit;color:inherit"><tbody><tr><td style="text-align:center"> <a style="text-decoration: none;" href="https://www.facebook.com/Odoo"><span class="fa fa-facebook-square fa-2x"></span></a><a style="text-decoration: none;" href="https://plus.google.com/+Odooapps"><span class="fa fa-google-plus-square fa-2x"></span></a><a style="text-decoration: none;" href="https://www.linkedin.com/company/odoo"><span class="fa fa-linkedin-square fa-2x"></span></a><a style="text-decoration: none;" href="https://twitter.com/Odoo"><span class="fa fa-twitter-square fa-2x"></span></a> </td></tr><tr><td style="font-size:12px;text-align:center;padding-top:10px;padding-bottom:5px"> <a href="/unsubscribe_from_list" style="color:#44B7B7">Unsubscribe</a>|<a href="/page/contactus" style="color:#44B7B7">Contact</a> </td></tr></tbody></table></div> </div>]]></field> </record> @@ -68,7 +68,7 @@ <field name="reply_to_mode">email</field> <field name="reply_to"><![CDATA[Info <info@yourcompany.example.com>]]></field> <field name="body_html"><![CDATA[<div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #ffffff repeat top /100%"> - <table cellpadding="0" cellspacing="0" style="border-collapse:collapse" width="100%"><tbody><tr><td style="padding:10px 10px 10px 5px" valign="center" width="270"> <a style="text-decoration:none" href="http://www.example.com"><strong class="o_default_snippet_text">Your Company</strong></a> </td><td style="padding:10px 15px 10px 10px;vertical-align:middle" valign="center" width="270"><table align="right" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse"><tbody><tr><td align="right"><a href="https://www.facebook.com/Odoo"><span class="fa fa-facebook-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-google-plus-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-linkedin-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-twitter-square fa-2x" style="color:#44B7B7;"></span></a></td></tr></tbody></table></td></tr></tbody></table></div><div style="padding:0px;width:600px;margin:auto;background-color:#44B7B7;color:#168484" class=""><table cellpadding="0" cellspacing="0" style="width:100%;background-color:inherit;border-collapse:collapse;color:inherit"><tbody><tr><td class="col_mv bg-color" style="text-align:left; padding-left:20px;vertical-align:middle;font-size:14px"><p style="margin:0;font-size:20px;color:#fff" class="o_default_snippet_text">You get a 20% discount for signing up!</p><p style="margin:0" class="o_default_snippet_text">Discount Code: <strong class="o_default_snippet_text">45A9E77DGW8455</strong></p></td><td class="col_mv bg-color" style="padding:20px;text-align:center;vertical-align:middle"> <span class="fa fa-6x fa-ticket"></span> </td></tr></tbody></table></div><div class="snippet_row bg-color" style="padding:0;width:600px;max-width:600px;margin:0 auto;background: #fff repeat top /100%;color:#168484"><table style="width:100%;text-align:justify;margin:0 auto;inherit;border-collapse:collapse;color:inherit"><tbody><tr><td style="padding:10px 30px;font-size:14px;line-height:20px"><p style="margin:0" class="o_default_snippet_text">Dear John</p><p style="margin:0" class="o_default_snippet_text">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br></p><p style="margin:0" class="o_default_snippet_text">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p><p style="margin:0" class="o_default_snippet_text">Kind Regards,</p><p style="margin:0" class="o_default_snippet_text">Michael Fletcher</p></td></tr></tbody></table></div><div style="padding:0;width:600px;max-width:600px;margin:0 auto" class=""><table style="width:100%;text-align:justify;margin:0 auto;background-color:inherit;border-collapse:collapse"><tbody><tr><td class="col_mv bg-color" style="padding:10px 0;background-color:#168484;color:#fff"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-check fa-3x"></span> </td><td style="padding-left:10px;color:#fff;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0" class="o_default_snippet_text">Step 1:</p><p style="margin:0" class="o_default_snippet_text">Place Order</p></td></tr></tbody></table></td><td class="col_mv bg-color" style="padding:10px 0;background-color:#FFFFFF;color:#808080"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-truck fa-3x"></span> </td><td style="padding-left:10px;color:#808080;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0" class="o_default_snippet_text">Step 2:</p><p style="margin:0" class="o_default_snippet_text">Shipping</p></td></tr></tbody></table></td><td class="col_mv bg-color" style="padding:10px 0;background-color:#FFFFFF;color:#808080"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-dollar fa-3x"></span> </td><td style="padding-left:10px;color:#808080;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0" class="o_default_snippet_text">Step 3:</p><p style="margin:0" class="o_default_snippet_text">Payment</p></td></tr></tbody></table></td></tr></tbody></table></div><div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #414141 repeat top /100%;color:#44B7B7"><div style="padding:10px"><table cellpadding="0" cellspacing="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit;color:inherit"><tbody><tr><td style="text-align:center"> <a style="text-decoration: none;" href="https://www.facebook.com/Odoo"><span class="fa fa-facebook-square fa-2x"></span></a><a style="text-decoration: none;" href="https://plus.google.com/+Odooapps"><span class="fa fa-google-plus-square fa-2x"></span></a><a style="text-decoration: none;" href="https://www.linkedin.com/company/odoo"><span class="fa fa-linkedin-square fa-2x"></span></a><a style="text-decoration: none;" href="https://twitter.com/Odoo"><span class="fa fa-twitter-square fa-2x"></span></a> </td></tr><tr><td style="font-size:12px;text-align:center;padding-top:10px;padding-bottom:5px" class="o_default_snippet_text"> <a href="/unsubscribe_from_list" style="color:#44B7B7" class="o_default_snippet_text">Unsubscribe</a>|<a href="/page/contactus" style="color:#44B7B7" class="o_default_snippet_text">Contact</a> </td></tr></tbody></table></div> + <table cellpadding="0" cellspacing="0" style="border-collapse:collapse" width="100%"><tbody><tr><td style="padding:10px 10px 10px 5px" valign="center" width="270"> <a style="text-decoration:none" href="http://www.example.com"><strong>Your Company</strong></a> </td><td style="padding:10px 15px 10px 10px;vertical-align:middle" valign="center" width="270"><table align="right" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse"><tbody><tr><td align="right"><a href="https://www.facebook.com/Odoo"><span class="fa fa-facebook-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-google-plus-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-linkedin-square fa-2x" style="color:#44B7B7;"></span></a></td><td align="right" style="padding-left:5px"><a href="https://www.facebook.com/Odoo"><span class="fa fa-twitter-square fa-2x" style="color:#44B7B7;"></span></a></td></tr></tbody></table></td></tr></tbody></table></div><div style="padding:0px;width:600px;margin:auto;background-color:#44B7B7;color:#168484"><table cellpadding="0" cellspacing="0" style="width:100%;background-color:inherit;border-collapse:collapse;color:inherit"><tbody><tr><td class="col_mv bg-color" style="text-align:left; padding-left:20px;vertical-align:middle;font-size:14px"><p style="margin:0;font-size:20px;color:#fff">You get a 20% discount for signing up!</p><p style="margin:0">Discount Code: <strong>45A9E77DGW8455</strong></p></td><td class="col_mv bg-color" style="padding:20px;text-align:center;vertical-align:middle"> <span class="fa fa-6x fa-ticket"></span> </td></tr></tbody></table></div><div class="snippet_row bg-color" style="padding:0;width:600px;max-width:600px;margin:0 auto;background: #fff repeat top /100%;color:#168484"><table style="width:100%;text-align:justify;margin:0 auto;inherit;border-collapse:collapse;color:inherit"><tbody><tr><td style="padding:10px 30px;font-size:14px;line-height:20px"><p style="margin:0">Dear ${object.name}</p><p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br></p><p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p><p style="margin:0">Kind Regards,</p><p style="margin:0">Michael Fletcher</p></td></tr></tbody></table></div><div style="padding:0;width:600px;max-width:600px;margin:0 auto"><table style="width:100%;text-align:justify;margin:0 auto;background-color:inherit;border-collapse:collapse"><tbody><tr><td class="col_mv bg-color" style="padding:10px 0;background-color:#168484;color:#fff"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-check fa-3x"></span> </td><td style="padding-left:10px;color:#fff;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0">Step 1:</p><p style="margin:0">Place Order</p></td></tr></tbody></table></td><td class="col_mv bg-color" style="padding:10px 0;background-color:#FFFFFF;color:#808080"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-truck fa-3x"></span> </td><td style="padding-left:10px;color:#808080;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0">Step 2:</p><p style="margin:0">Shipping</p></td></tr></tbody></table></td><td class="col_mv bg-color" style="padding:10px 0;background-color:#FFFFFF;color:#808080"><table style="border-collapse:collapse;background-color:inherit"><tbody><tr><td rowspan="2" style="padding-left:10px"> <span class="fa fa-dollar fa-3x"></span> </td><td style="padding-left:10px;color:#808080;font-size:14px"><p style="font-weight:bold;font-size:18px;margin:0 0 3px 0">Step 3:</p><p style="margin:0">Payment</p></td></tr></tbody></table></td></tr></tbody></table></div><div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #414141 repeat top /100%;color:#44B7B7"><div style="padding:10px"><table cellpadding="0" cellspacing="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit;color:inherit"><tbody><tr><td style="text-align:center"> <a style="text-decoration: none;" href="https://www.facebook.com/Odoo"><span class="fa fa-facebook-square fa-2x"></span></a><a style="text-decoration: none;" href="https://plus.google.com/+Odooapps"><span class="fa fa-google-plus-square fa-2x"></span></a><a style="text-decoration: none;" href="https://www.linkedin.com/company/odoo"><span class="fa fa-linkedin-square fa-2x"></span></a><a style="text-decoration: none;" href="https://twitter.com/Odoo"><span class="fa fa-twitter-square fa-2x"></span></a> </td></tr><tr><td style="font-size:12px;text-align:center;padding-top:10px;padding-bottom:5px"> <a href="/unsubscribe_from_list" style="color:#44B7B7">Unsubscribe</a>|<a href="/page/contactus" style="color:#44B7B7">Contact</a> </td></tr></tbody></table></div> </div>]]></field> <field name="attachment_ids" eval="[(4, ref('mass_mail_attach_1'))]"/> </record> diff --git a/addons/mass_mailing/models/__init__.py b/addons/mass_mailing/models/__init__.py index 1e9affea3e7..8ae20b69f90 100644 --- a/addons/mass_mailing/models/__init__.py +++ b/addons/mass_mailing/models/__init__.py @@ -6,4 +6,4 @@ import mail_mail import mail_thread import res_config import mass_mailing_report -import website_links +import link_tracker diff --git a/addons/mass_mailing/models/website_links.py b/addons/mass_mailing/models/link_tracker.py index f5e10a817d0..02de2ec4cd6 100644 --- a/addons/mass_mailing/models/website_links.py +++ b/addons/mass_mailing/models/link_tracker.py @@ -1,15 +1,15 @@ from openerp import fields from openerp import models -class website_links(models.Model): - _inherit = "website.links" +class link_tracker(models.Model): + _inherit = "link.tracker" mass_mailing_id = fields.Many2one('mail.mass_mailing', string='Mass Mailing') mass_mailing_campaign_id = fields.Many2one('mail.mass_mailing.campaign', string='Mass Mailing Campaign') -class website_links_click(models.Model): - _inherit = "website.links.click" +class link_tracker_click(models.Model): + _inherit = "link.tracker.click" mail_stat_id = fields.Many2one('mail.mail.statistics', string='Mail Statistics') mass_mailing_id = fields.Many2one('mail.mass_mailing', string='Mass Mailing') - mass_mailing_campaign_id = fields.Many2one('mail.mass_mailing.campaign', string='Mass Mailing Campaign')
\ No newline at end of file + mass_mailing_campaign_id = fields.Many2one('mail.mass_mailing.campaign', string='Mass Mailing Campaign') diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index 2fe192b5ea3..05dd09ddfd9 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -208,7 +208,7 @@ class MassMailingCampaign(osv.Model): cr.execute(""" SELECT COUNT(DISTINCT(stats.id)) AS nb_mails, COUNT(DISTINCT(clicks.mail_stat_id)) AS nb_clicks, stats.mass_mailing_campaign_id AS id FROM mail_mail_statistics AS stats - LEFT OUTER JOIN website_links_click AS clicks ON clicks.mail_stat_id = stats.id + LEFT OUTER JOIN link_tracker_click AS clicks ON clicks.mail_stat_id = stats.id WHERE stats.mass_mailing_campaign_id IN %s GROUP BY stats.mass_mailing_campaign_id """, (tuple(ids), )) @@ -436,7 +436,7 @@ class MassMailing(osv.Model): cr.execute(""" SELECT COUNT(DISTINCT(stats.id)) AS nb_mails, COUNT(DISTINCT(clicks.mail_stat_id)) AS nb_clicks, stats.mass_mailing_id AS id FROM mail_mail_statistics AS stats - LEFT OUTER JOIN website_links_click AS clicks ON clicks.mail_stat_id = stats.id + LEFT OUTER JOIN link_tracker_click AS clicks ON clicks.mail_stat_id = stats.id WHERE stats.mass_mailing_id IN %s GROUP BY stats.mass_mailing_id """, (tuple(ids), )) @@ -583,7 +583,7 @@ class MassMailing(osv.Model): def mass_mailing_statistics_action(self, cr, uid, ids, context=None): res = self.pool['ir.actions.act_window'].for_xml_id(cr, uid, 'mass_mailing', 'action_view_mass_mailing_statistics', context=context) - link_click_ids = self.pool['website.links.click'].search(cr, uid, [('mass_mailing_id', 'in', ids)], context=context) + link_click_ids = self.pool['link.tracker.click'].search(cr, uid, [('mass_mailing_id', 'in', ids)], context=context) res['domain'] = [('id', 'in', link_click_ids)] return res @@ -796,7 +796,7 @@ class MassMailing(osv.Model): if utm_mixin.medium_id: vals['medium_id'] = utm_mixin.medium_id.id - res[mass_mailing.id] = self.pool['website.links'].convert_links(cr, uid, html, vals, blacklist=['/unsubscribe_from_list'], context=context) + res[mass_mailing.id] = self.pool['link.tracker'].convert_links(cr, uid, html, vals, blacklist=['/unsubscribe_from_list'], context=context) return res diff --git a/addons/mass_mailing/models/mass_mailing_stats.py b/addons/mass_mailing/models/mass_mailing_stats.py index 7d50e9ab42b..58ab233c4ae 100644 --- a/addons/mass_mailing/models/mass_mailing_stats.py +++ b/addons/mass_mailing/models/mass_mailing_stats.py @@ -78,7 +78,7 @@ class MailMailStats(osv.Model): 'opened': fields.datetime('Opened', help='Date when the email has been opened the first time'), 'replied': fields.datetime('Replied', help='Date when this email has been replied for the first time.'), 'bounced': fields.datetime('Bounced', help='Date when this email has bounced.'), - 'links_click_ids': fields.one2many('website.links.click', 'mail_stat_id', 'Links click'), + 'links_click_ids': fields.one2many('link.tracker.click', 'mail_stat_id', 'Links click'), 'state': fields.function(_compute_state, string='State', type="selection", multi="state", selection=[('outgoing', 'Outgoing'), ('exception', 'Exception'), diff --git a/addons/mass_mailing/static/src/js/mass_mailing_editor.js b/addons/mass_mailing/static/src/js/mass_mailing_editor.js index 9449af6445f..4974674ba3a 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_editor.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_editor.js @@ -1,4 +1,4 @@ -odoo.define('website_mail.website_mail', function (require) { +odoo.define('mass_mailing.editor', function (require) { "use strict"; var Model = require('web.Model'); @@ -36,7 +36,7 @@ options.registry["width-x"] = options.Class.extend({ if ($handle.hasClass(handler)) { compass = handler; } }); if(self.is_image){ compass = "image"; } - self.BuildingBlock.editor_busy = true; + self.buildingBlock.editor_busy = true; var $body = $(document.body); @@ -63,7 +63,7 @@ options.registry["width-x"] = options.Class.extend({ var body_mouseup = function(){ $body.unbind('mousemove', body_mousemove); $body.unbind('mouseup', body_mouseup); - self.BuildingBlock.editor_busy = false; + self.buildingBlock.editor_busy = false; self.$target.removeClass("resize_editor_busy"); }; $body.mousemove(body_mousemove); @@ -78,7 +78,7 @@ options.registry["width-x"] = options.Class.extend({ var width = offset + target_width - event.pageX; } target.css("width", width + "px"); - self.BuildingBlock.cover_target(self.$overlay, self.$target); + self.buildingBlock.cover_target(self.$overlay, self.$target); return; }, get_int_width: function ($el) { @@ -106,7 +106,7 @@ options.registry["width-x"] = options.Class.extend({ }); } this._super($clone); - this.BuildingBlock.cover_target(this.$overlay, this.$target); + this.buildingBlock.cover_target(this.$overlay, this.$target); }, on_remove: function () { var remove_index = $(this.$target).index(); @@ -118,7 +118,7 @@ options.registry["width-x"] = options.Class.extend({ }); } this._super(); - this.BuildingBlock.cover_target(this.$overlay, this.$target); + this.buildingBlock.cover_target(this.$overlay, this.$target); }, }); @@ -168,6 +168,9 @@ web_editor.Class.include({ $("#choose_template").children().toggleClass("hidden"); $("body").trigger("resize"); $(window.top).trigger('resize'); + setTimeout(function () { + $(".note-popover").toggleClass("hidden", $("#templates").is(":visible")); + },0); }, on_set_snippet_template: function (event) { var $editable = $("#editable_area"); diff --git a/addons/mass_mailing/views/mass_mailing.xml b/addons/mass_mailing/views/mass_mailing.xml index 2e1e1859d83..a6b8d1f5099 100644 --- a/addons/mass_mailing/views/mass_mailing.xml +++ b/addons/mass_mailing/views/mass_mailing.xml @@ -329,8 +329,8 @@ </record> <record model="ir.ui.view" id="view_mail_mass_mailing_links_tree"> - <field name="name">website.links.tree</field> - <field name="model">website.links</field> + <field name="name">link.tracker.tree</field> + <field name="model">link.tracker</field> <field name="priority">10</field> <field name="arch" type="xml"> <tree string="Mailing Statistics of Clicks"> @@ -342,9 +342,9 @@ </record> <record model="ir.ui.view" id="view_mail_mass_mailing_links_search"> - <field name="name">website.links.search</field> - <field name="model">website.links</field> - <field name="inherit_id" ref="website_links.view_website_links_filter"/> + <field name="name">link.tracker.search</field> + <field name="model">link.tracker</field> + <field name="inherit_id" ref="link_tracker.view_link_tracker_filter"/> <field name="arch" type="xml"> <search string="Tracked Link"> <field name="mass_mailing_id"/> @@ -355,7 +355,7 @@ <record model="ir.actions.act_window" id="action_view_mass_mailing_links_statistics"> <field name="name">Statistics of Clicks</field> - <field name="res_model">website.links</field> + <field name="res_model">link.tracker</field> <field name="view_mode">tree</field> <field name="context">{'search_default_mass_mailing_id': active_id}</field> </record> @@ -709,7 +709,7 @@ <record model="ir.actions.act_window" id="dropdb snipp"> <field name="name">Statistics of Clicks</field> - <field name="res_model">website.links</field> + <field name="res_model">link.tracker</field> <field name="view_mode">tree</field> <field name="context">{'search_default_mass_mailing_campaign_id': active_id}</field> </record> diff --git a/addons/mass_mailing/views/snippets_themes.xml b/addons/mass_mailing/views/snippets_themes.xml index a102d2f7a6a..01ca28cbaf9 100644 --- a/addons/mass_mailing/views/snippets_themes.xml +++ b/addons/mass_mailing/views/snippets_themes.xml @@ -56,7 +56,7 @@ <tr> <td valign="center" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; @@ -74,7 +74,7 @@ <tr> <td valign="center" style="text-align:center;font-size: 30px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: inherit;"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: inherit;"> <strong>Your Company</strong> </a> &nbsp; @@ -91,13 +91,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px;"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse;background:inherit;color:inherit"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse;background:inherit;color:inherit"> <tr> <td align="right"> <a t-att-href="(website.social_facebook) or '#'"><img src="/mass_mailing/static/src/img/theme_imgs/social_facebook.png" style="height:auto;max-width:70px" alt="social icon"/></a> @@ -128,13 +128,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px;font-size: 30px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: inherit"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: inherit"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse;background:inherit;color:inherit"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse;background:inherit;color:inherit"> <tr> <td align="right"> <a t-att-href="(website.social_facebook) or '#'"><img src="/mass_mailing/static/src/img/theme_imgs/social_facebook.png" style="height:auto;max-width:70px" alt="social icon" /></a> @@ -343,7 +343,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;background:inherit;color:inherit;border-collapse:collapse;color:inherit"> <tr> <td style="padding:10px 30px;font-size:14px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -401,7 +401,7 @@ </span> Footers </div> <div class="o_panel_body"> - <div name="Social + Text" class="basic_theme o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="basic_theme o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777"> <table style="margin: 0 auto;border-collapse:collapse;background:inherit;color:inherit;width:600px" cellpadding="0" cellspacing="0"> <tbody> @@ -459,7 +459,8 @@ <tr> <td style="font-size:12px;text-align:center;padding:10px"> &nbsp; - <a style="color:inherit" href="/unsubscribe_from_list">Unsubscribe</a> | <a style="color:inherit" href="/page/contactus">Contact</a> + <a style="color:inherit" href="/unsubscribe_from_list">Unsubscribe</a> + <t t-if="website"> | <a style="color:inherit" href="/page/contactus">Contact</a> </t> &nbsp; </td> </tr> @@ -481,7 +482,13 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:20px;text-align:center"> &nbsp; - <a style="color:inherit" href="/page/contactus">Contact Us</a> | <a style="color:inherit" t-att-href="(website.social_facebook) or '#'">Facebook</a> | <a style="color:inherit" t-att-href="(website.social_twitter) or '#'">Twitter</a> | <a style="color:inherit" href="#">Support</a> | <a href="/unsubscribe_from_list" style="color:inherit">Unsubscribe</a> + <t t-if="website"> + <a style="color:inherit" href="/page/contactus">Contact Us</a> | + <a style="color:inherit" t-att-href="(website.social_facebook) or '#'">Facebook</a> | + <a style="color:inherit" t-att-href="(website.social_twitter) or '#'">Twitter</a> | + <a style="color:inherit" href="#">Support</a> | + </t> + <a href="/unsubscribe_from_list" style="color:inherit">Unsubscribe</a> &nbsp; </td> </tr> diff --git a/addons/mass_mailing/views/theme/airmail_snippets.xml b/addons/mass_mailing/views/theme/airmail_snippets.xml index abca4fcf0ba..3900402eca4 100644 --- a/addons/mass_mailing/views/theme/airmail_snippets.xml +++ b/addons/mass_mailing/views/theme/airmail_snippets.xml @@ -11,7 +11,7 @@ <tr> <td width="100%" valign="top" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; @@ -30,7 +30,7 @@ <tr> <td width="100%" valign="top" style="text-align:center;font-size: 30px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color:#464646"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color:#464646"> <strong>Your Company</strong> </a> &nbsp; @@ -48,13 +48,13 @@ <tr> <td width="100%" valign="top" style="font-size: 30px;padding-left:5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -99,13 +99,13 @@ <tr> <td width="100%" valign="top" style="vertical-align: middle;padding-left:5px;font-size: 30px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color:#464646"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color:#464646"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -267,7 +267,7 @@ </ul> </td> <td style="width: 60px;vertical-align:middle;display: table-cell"> - <ul style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> + <ul t-if="website" style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> <t t-if="website.social_facebook"> <li style="width:33%;margin-left:0"> <a t-att-href="website.social_facebook"> @@ -277,14 +277,14 @@ </t> <t t-if="website.social_twitter"> <li style="width:34%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color: rgb(75,110,168);" class="fa fa-twitter-square fa-2x"></span> </a> </li> </t> <t t-if="website.social_googleplus"> <li style="width:33%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color: rgb(221,75,57);" class="fa fa-google-plus-square fa-2x"></span> </a> </li> @@ -482,7 +482,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;border-collapse:collapse;color:inherit"> <tr> <td style="padding:10px 30px;font-size:14px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -602,7 +602,7 @@ </xpath> <xpath expr="//div[@id='email_designer_default_footer']/div[2]" position="inside"> - <div name="Social + Text" class="airmail o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="airmail o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #E5E5E5 repeat top /100%;color:#464646"> <div style="padding:10px"> <table cellspacing="0" cellpadding="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit"> @@ -653,7 +653,8 @@ <tr> <td style="font-size:12px;text-align:center;padding:10px;color:#464646"> &nbsp; - <a href="/unsubscribe_from_list" style="color:#464646">Unsubscribe</a> | <a href="/page/contactus" style="color:#464646">Contact</a> + <a href="/unsubscribe_from_list" style="color:#464646">Unsubscribe</a> + <t t-if="website"> | <a href="/page/contactus" style="color:#464646">Contact</a> </t> &nbsp; </td> </tr> @@ -675,12 +676,14 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:10px;text-align:center"> &nbsp; - <a href="/page/contactus" style="padding-right:3px;color:#464646">Contact Us</a> | - <t t-if="website.social_facebook"> - <a t-att-href="website.social_facebook" style="padding-right:3px;color:#464646">Facebook</a> | - </t> - <t t-if="website.social_twitter"> - <a t-att-href="website.social_twitter" style="padding-right:3px;color:#464646">Twitter</a> | + <t t-if="website"> + <a href="/page/contactus" style="padding-right:3px;color:#464646">Contact Us</a> | + <t t-if="website.social_facebook"> + <a t-att-href="website.social_facebook" style="padding-right:3px;color:#464646">Facebook</a> | + </t> + <t t-if="website.social_twitter"> + <a t-att-href="website.social_twitter" style="padding-right:3px;color:#464646">Twitter</a> | + </t> </t> <a href="/unsubscribe_from_list" style="color:#464646">Unsubscribe</a> &nbsp; diff --git a/addons/mass_mailing/views/theme/cleave_snippets.xml b/addons/mass_mailing/views/theme/cleave_snippets.xml index dc471d231db..f3a7725febe 100644 --- a/addons/mass_mailing/views/theme/cleave_snippets.xml +++ b/addons/mass_mailing/views/theme/cleave_snippets.xml @@ -10,7 +10,7 @@ <tr> <td valign="center" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; @@ -28,7 +28,7 @@ <tr> <td style="font-size: 30px; text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color:#414141"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color:#414141"> <strong>Your Company</strong> </a> &nbsp; @@ -45,13 +45,13 @@ <tr> <td width="100%" valign="top" style="font-size: 30px;padding-left:5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="height:auto;max-width:600px;width:200px;padding:10px" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -95,13 +95,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: #414141;font-size: 30px; text-align:center"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: #414141;font-size: 30px; text-align:center"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -276,7 +276,7 @@ </ul> </td> <td style="width: 60px;vertical-align:middle;display: table-cell"> - <ul style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> + <ul t-if="website" style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> <t t-if="website.social_facebook"> <li style="width:33%;margin-left:0"> <a t-att-href="website.social_facebook"> @@ -286,14 +286,14 @@ </t> <t t-if="website.social_twitter"> <li style="width:34%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color: rgb(75,110,168);" class="fa fa-twitter-square fa-2x"></span> </a> </li> </t> <t t-if="website.social_googleplus"> <li style="width:33%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color: rgb(221,75,57);" class="fa fa-google-plus-square fa-2x"></span> </a> </li> @@ -466,7 +466,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;border-collapse:collapse;color:inherit"> <tr> <td style="padding:10px 30px;font-size:14px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -586,7 +586,7 @@ </xpath> <xpath expr="//div[@id='email_designer_default_footer']/div[2]" position="inside"> - <div name="Social + Text" class="cleave o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="cleave o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #E6E5E5 repeat top /100%;color:#414141"> <div style="padding:10px"> <table cellspacing="0" cellpadding="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit"> @@ -635,7 +635,8 @@ <tr> <td style="font-size:12px;text-align:center;padding-top:10px;padding-bottom:5px"> &nbsp; - <a href="/unsubscribe_from_list" style="color:#414141">Unsubscribe</a> | <a href="/page/contactus" style="color:#414141">Contact</a> + <a href="/unsubscribe_from_list" style="color:#414141">Unsubscribe</a> + <t t-if="website"> | <a href="/page/contactus" style="color:#414141">Contact</a> </t> &nbsp; </td> </tr> @@ -657,12 +658,14 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:10px;text-align:center"> &nbsp; - <a href="/page/contactus" style="color:#414141">Contact Us</a> | - <t t-if="website.social_facebook"> - <a t-att-href="website.social_facebook" style="color:#414141">Facebook</a> | - </t> - <t t-if="website.social_twitter"> - <a t-att-href="website.social_twitter" style="color:#414141">Twitter</a> | + <t t-if="website"> + <a href="/page/contactus" style="color:#414141">Contact Us</a> | + <t t-if="website.social_facebook"> + <a t-att-href="website.social_facebook" style="color:#414141">Facebook</a> | + </t> + <t t-if="website.social_twitter"> + <a t-att-href="website.social_twitter" style="color:#414141">Twitter</a> | + </t> </t> <a href="/unsubscribe_from_list" style="color:#414141">Unsubscribe</a> &nbsp; diff --git a/addons/mass_mailing/views/theme/go_snippets.xml b/addons/mass_mailing/views/theme/go_snippets.xml index 6534d86ce39..6782cff526b 100644 --- a/addons/mass_mailing/views/theme/go_snippets.xml +++ b/addons/mass_mailing/views/theme/go_snippets.xml @@ -10,7 +10,7 @@ <tr> <td valign="center" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; @@ -28,7 +28,7 @@ <tr> <td style="font-size: 30px; text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color:#fff"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color:#fff"> <strong>Your Company</strong> </a> &nbsp; @@ -45,13 +45,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -95,13 +95,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px;font-size: 30px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: #fff"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: #fff"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -248,7 +248,7 @@ </ul> </td> <td style="width: 60px;vertical-align:middle;display: table-cell"> - <ul style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> + <ul t-if="website" style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> <t t-if="website.social_facebook"> <li style="width:33%;margin-left:0"> <a t-att-href="website.social_facebook"> @@ -258,14 +258,14 @@ </t> <t t-if="website.social_twitter"> <li style="width:34%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color: rgb(75,110,168);" class="fa fa-twitter-square fa-2x"></span> </a> </li> </t> <t t-if="website.social_googleplus"> <li style="width:33%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color: rgb(221,75,57);" class="fa fa-google-plus-square fa-2x"></span> </a> </li> @@ -511,7 +511,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;border-collapse:collapse;color:inherit"> <tr> <td style="padding:10px 30px;font-size:14px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -631,7 +631,7 @@ </xpath> <xpath expr="//div[@id='email_designer_default_footer']/div[2]" position="inside"> - <div name="Social + Text" class="go o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="go o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #2B934F repeat top /100%;color:#EEEEEE"> <div style="padding:10px"> <table cellspacing="0" cellpadding="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit"> @@ -682,7 +682,8 @@ <tr> <td style="font-size:12px;text-align:center;padding:10px;color:#fff"> &nbsp; - <a style="color:#fff" href="/unsubscribe_from_list">Unsubscribe</a> | <a style="color:#fff" href="/page/contactus">Contact</a> + <a style="color:#fff" href="/unsubscribe_from_list">Unsubscribe</a> + <t t-if="website"> | <a style="color:#fff" href="/page/contactus">Contact</a> </t> &nbsp; </td> </tr> @@ -704,12 +705,14 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:20px;text-align:center"> &nbsp; - <a style="color:#fff" href="/page/contactus">Contact Us</a> | - <t t-if="website.social_facebook"> - <a style="color:#fff" t-att-href="website.social_facebook">Facebook</a> | - </t> - <t t-if="website.social_twitter"> - <a style="color:#fff" t-att-href="website.social_twitter">Twitter</a> | + <t t-if="website"> + <a style="color:#fff" href="/page/contactus">Contact Us</a> | + <t t-if="website.social_facebook"> + <a style="color:#fff" t-att-href="website.social_facebook">Facebook</a> | + </t> + <t t-if="website.social_twitter"> + <a style="color:#fff" t-att-href="website.social_twitter">Twitter</a> | + </t> </t> <a href="/unsubscribe_from_list" style="color:#fff">Unsubscribe</a> &nbsp; diff --git a/addons/mass_mailing/views/theme/narrative_snippets.xml b/addons/mass_mailing/views/theme/narrative_snippets.xml index e8db15a1ff2..f011b44d92f 100644 --- a/addons/mass_mailing/views/theme/narrative_snippets.xml +++ b/addons/mass_mailing/views/theme/narrative_snippets.xml @@ -10,7 +10,7 @@ <tr> <td valign="center" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px" alt="Your Logo" /> </a> &nbsp; @@ -28,7 +28,7 @@ <tr> <td style="font-size: 30px; text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color:#fff"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color:#fff"> <strong>Your Company</strong> </a> &nbsp; @@ -45,13 +45,13 @@ <tr> <td valign="center" width="270" style="padding-left:5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="height:auto;max-width:600px" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -95,13 +95,13 @@ <tr> <td valign="center" width="270" style="padding-left:5px;font-size:30px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: #fff"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: #fff"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -314,7 +314,7 @@ </ul> </td> <td style="width: 60px;vertical-align:middle;display: table-cell"> - <ul style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> + <ul t-if="website" style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> <t t-if="website.social_facebook"> <li style="width:33%;margin-left:0"> <a t-att-href="website.social_facebook"> @@ -324,14 +324,14 @@ </t> <t t-if="website.social_twitter"> <li style="width:34%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color: rgb(75,110,168);" class="fa fa-twitter-square fa-2x"></span> </a> </li> </t> <t t-if="website.social_googleplus"> <li style="width:33%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color: rgb(221,75,57);" class="fa fa-google-plus-square fa-2x"></span> </a> </li> @@ -483,7 +483,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;border-collapse:collapse;color:inherit"> <tr> <td style="padding:10px 30px;font-size:14px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -603,7 +603,7 @@ </xpath> <xpath expr="//div[@id='email_designer_default_footer']/div[2]" position="inside"> - <div name="Social + Text" class="narrative o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="narrative o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #1F1F1F repeat top /100%;color:#fff"> <div style="padding:10px"> <table cellspacing="0" cellpadding="0" style="margin: 0 auto;width:600px;border-collapse:collapse;color:inherit"> @@ -654,7 +654,8 @@ <tr> <td style="font-size:12px;text-align:center;padding-top:10px;padding-bottom:5px;color:#fff"> &nbsp; - <a href="/unsubscribe_from_list" style="color:#fff">Unsubscribe</a> | <a href="/page/contactus" style="color:#fff">Contact</a> + <a href="/unsubscribe_from_list" style="color:#fff">Unsubscribe</a> + <t t-if="website"> | <a href="/page/contactus" style="color:#fff">Contact</a> </t> &nbsp; </td> </tr> @@ -676,12 +677,14 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:20px;text-align:center"> &nbsp; - <a href="/page/contactus" style="color:#fff">Contact Us</a> | - <t t-if="website.social_facebook"> - <a t-att-href="website.social_facebook" style="color:#fff">Facebook</a> | - </t> - <t t-if="website.social_twitter"> - <a t-att-href="website.social_twitter" style="color:#fff">Twitter</a> | + <t t-if="website"> + <a href="/page/contactus" style="color:#fff">Contact Us</a> | + <t t-if="website.social_facebook"> + <a t-att-href="website.social_facebook" style="color:#fff">Facebook</a> | + </t> + <t t-if="website.social_twitter"> + <a t-att-href="website.social_twitter" style="color:#fff">Twitter</a> | + </t> </t> <a href="/unsubscribe_from_list" style="color:#fff">Unsubscribe</a> &nbsp; diff --git a/addons/mass_mailing/views/theme/neopolitan_snippets.xml b/addons/mass_mailing/views/theme/neopolitan_snippets.xml index 389b02d6c04..90b3315d33c 100644 --- a/addons/mass_mailing/views/theme/neopolitan_snippets.xml +++ b/addons/mass_mailing/views/theme/neopolitan_snippets.xml @@ -10,7 +10,7 @@ <tr> <td valign="center" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;" alt="Your Logo" /> </a> &nbsp; @@ -28,7 +28,7 @@ <tr> <td style="font-size: 30px; text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color:#414141"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color:#414141"> <strong>Your Company</strong> </a> &nbsp; @@ -45,13 +45,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -62,21 +62,21 @@ </t> <t t-if="website.social_googleplus"> <td align="right" style="padding-left:5px"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color:#44B7B7;" class="fa fa-google-plus-square fa-2x"></span> </a> </td> </t> <t t-if="website.social_linkedin"> <td align="right" style="padding-left:5px"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_linkedin"> <span style="color:#44B7B7;" class="fa fa-linkedin-square fa-2x"></span> </a> </td> </t> <t t-if="website.social_twitter"> <td align="right" style="padding-left:5px"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color:#44B7B7;" class="fa fa-twitter-square fa-2x"></span> </a> </td> @@ -95,13 +95,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: #414141;font-size: 30px; text-align:center"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: #414141;font-size: 30px; text-align:center"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -112,21 +112,21 @@ </t> <t t-if="website.social_googleplus"> <td align="right" style="padding-left:5px"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color:#44B7B7;" class="fa fa-google-plus-square fa-2x"></span> </a> </td> </t> <t t-if="website.social_linkedin"> <td align="right" style="padding-left:5px"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_linkedin"> <span style="color:#44B7B7;" class="fa fa-linkedin-square fa-2x"></span> </a> </td> </t> <t t-if="website.social_twitter"> <td align="right" style="padding-left:5px"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color:#44B7B7;" class="fa fa-twitter-square fa-2x"></span> </a> </td> @@ -246,7 +246,7 @@ </ul> </td> <td style="width: 60px;vertical-align:middle;display: table-cell"> - <ul style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> + <ul t-if="website" style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> <t t-if="website.social_facebook"> <li style="width:33%;margin-left:0"> <a t-att-href="website.social_facebook"> @@ -256,14 +256,14 @@ </t> <t t-if="website.social_twitter"> <li style="width:34%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color: rgb(75,110,168);" class="fa fa-twitter-square fa-2x"></span> </a> </li> </t> <t t-if="website.social_googleplus"> <li style="width:33%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color: rgb(221,75,57);" class="fa fa-google-plus-square fa-2x"></span> </a> </li> @@ -450,7 +450,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;inherit;border-collapse:collapse;color:inherit"> <tr> <td style="padding:10px 30px;font-size:14px;line-height:20px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -570,7 +570,7 @@ </xpath> <xpath expr="//div[@id='email_designer_default_footer']/div[2]" position="inside"> - <div name="Social + Text" class="neopolitan o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="neopolitan o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #414141 repeat top /100%;color:#44B7B7"> <div style="padding:10px"> <table cellspacing="0" cellpadding="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit;color:inherit"> @@ -621,7 +621,9 @@ <tr> <td style="font-size:12px;text-align:center;padding-top:10px;color:#44B7B7;padding-bottom:5px"> &nbsp; - <a href="/unsubscribe_from_list" style="color:#44B7B7">Unsubscribe</a> | <a href="/page/contactus" style="color:#44B7B7">Contact</a>&nbsp; + <a href="/unsubscribe_from_list" style="color:#44B7B7">Unsubscribe</a> + <t t-if="website"> | <a href="/page/contactus" style="color:#44B7B7">Contact</a> </t> + &nbsp; </td> </tr> <tr> @@ -642,12 +644,14 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:10px;text-align:center"> &nbsp; - <a href="/page/contactus" style="color:#44B7B7">Contact Us</a> | - <t t-if="website.social_facebook"> - <a t-att-href="website.social_facebook" style="color:#44B7B7">Facebook</a> | - </t> - <t t-if="website.social_twitter"> - <a t-att-href="website.social_twitter" style="color:#44B7B7">Twitter</a> | + <t t-if="website"> + <a href="/page/contactus" style="color:#44B7B7">Contact Us</a> | + <t t-if="website.social_facebook"> + <a t-att-href="website.social_facebook" style="color:#44B7B7">Facebook</a> | + </t> + <t t-if="website.social_twitter"> + <a t-att-href="website.social_twitter" style="color:#44B7B7">Twitter</a> | + </t> </t> <a href="/unsubscribe_from_list" style="color:#44B7B7">Unsubscribe</a> &nbsp; diff --git a/addons/mass_mailing/views/theme/skyline_snippets.xml b/addons/mass_mailing/views/theme/skyline_snippets.xml index 7e7c0974481..01bac988083 100644 --- a/addons/mass_mailing/views/theme/skyline_snippets.xml +++ b/addons/mass_mailing/views/theme/skyline_snippets.xml @@ -10,7 +10,7 @@ <tr> <td valign="center" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; @@ -28,7 +28,7 @@ <tr> <td style="font-size: 30px; text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color:#37302d"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color:#37302d"> <strong>Your Company</strong> </a> &nbsp; @@ -45,13 +45,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -95,13 +95,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: #37302d;font-size: 30px; text-align:center"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: #37302d;font-size: 30px; text-align:center"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -243,7 +243,7 @@ </ul> </td> <td style="width: 60px;vertical-align:middle;display: table-cell"> - <ul style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> + <ul t-if="website" style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> <t t-if="website.social_facebook"> <li style="width:33%;margin-left:0"> <a t-att-href="website.social_facebook"> @@ -253,14 +253,14 @@ </t> <t t-if="website.social_twitter"> <li style="width:34%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color: rgb(75,110,168);" class="fa fa-twitter-square fa-2x"></span> </a> </li> </t> <t t-if="website.social_googleplus"> <li style="width:33%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color: rgb(221,75,57);" class="fa fa-google-plus-square fa-2x"></span> </a> </li> @@ -465,7 +465,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;border-collapse:collapse;color:inherit"> <tr> <td style="padding:10px 30px;font-size:14px;line-height:20px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -585,7 +585,7 @@ </xpath> <xpath expr="//div[@id='email_designer_default_footer']/div[2]" position="inside"> - <div name="Social + Text" class="skyline o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="skyline o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #C2C2C2 repeat top /100%;color:#37302d"> <div style="padding:10px"> <table cellspacing="0" cellpadding="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit"> @@ -636,7 +636,8 @@ <tr> <td style="font-size:12px;text-align:center;padding:10px;color:#37302D"> &nbsp; - <a style="color:#37302D" href="/unsubscribe_from_list">Unsubscribe</a> | <a style="color:#37302D" href="/page/contactus">Contact</a> + <a style="color:#37302D" href="/unsubscribe_from_list">Unsubscribe</a> + <t t-if="website"> | <a style="color:#37302D" href="/page/contactus">Contact</a> </t> &nbsp; </td> </tr> @@ -658,12 +659,14 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:20px;text-align:center"> &nbsp; - <a style="color:#37302D" href="/page/contactus">Contact Us</a> | - <t t-if="website.social_facebook"> - <a style="color:#37302D" t-att-href="website.social_facebook">Facebook</a> | - </t> - <t t-if="website.social_twitter"> - <a style="color:#37302D" t-att-href="website.social_twitter">Twitter</a> | + <t t-if="website"> + <a style="color:#37302D" href="/page/contactus">Contact Us</a> | + <t t-if="website.social_facebook"> + <a style="color:#37302D" t-att-href="website.social_facebook">Facebook</a> | + </t> + <t t-if="website.social_twitter"> + <a style="color:#37302D" t-att-href="website.social_twitter">Twitter</a> | + </t> </t> <a href="/unsubscribe_from_list" style="color:#37302D">Unsubscribe</a> &nbsp; diff --git a/addons/mass_mailing/views/theme/sunday_snippets.xml b/addons/mass_mailing/views/theme/sunday_snippets.xml index a1e3dc07a6d..f5171f1710a 100644 --- a/addons/mass_mailing/views/theme/sunday_snippets.xml +++ b/addons/mass_mailing/views/theme/sunday_snippets.xml @@ -10,7 +10,7 @@ <tr> <td valign="center" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; @@ -28,7 +28,7 @@ <tr> <td style="font-size: 30px; text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: #414141"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: #414141"> <strong>Your Company</strong> </a> &nbsp; @@ -45,13 +45,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px;width:200px" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -95,13 +95,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: #414141;font-size: 30px; text-align:center"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: #414141;font-size: 30px; text-align:center"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -246,7 +246,7 @@ </ul> </td> <td style="width: 60px;vertical-align:middle;display: table-cell"> - <ul style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> + <ul t-if="website" style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> <t t-if="website.social_facebook"> <li style="width:33%;margin-left:0"> <a t-att-href="website.social_facebook"> @@ -256,14 +256,14 @@ </t> <t t-if="website.social_twitter"> <li style="width:34%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color: rgb(75,110,168);" class="fa fa-twitter-square fa-2x"></span> </a> </li> </t> <t t-if="website.social_googleplus"> <li style="width:33%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color: rgb(221,75,57);" class="fa fa-google-plus-square fa-2x"></span> </a> </li> @@ -466,7 +466,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;color:inherit;border-collapse:collapse"> <tr> <td style="padding:10px 30px;font-size:14px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -586,7 +586,7 @@ </xpath> <xpath expr="//div[@id='email_designer_default_footer']/div[2]" position="inside"> - <div name="Social + Text" class="sunday o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="sunday o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #2F2F2F repeat top /100%;color:#EEEEEE"> <div style="padding:10px"> <table cellspacing="0" cellpadding="0" style="margin: 0 auto;width:100%;border-collapse:collapse;color:inherit"> @@ -637,7 +637,8 @@ <tr> <td style="font-size:12px;text-align:center;padding:10px;color:#fff"> &nbsp; - <a style="color:#fff" href="/unsubscribe_from_list">Unsubscribe</a> | <a style="color:#fff" href="/page/contactus">Contact</a> + <a style="color:#fff" href="/unsubscribe_from_list">Unsubscribe</a> + <t t-if="website"> | <a style="color:#fff" href="/page/contactus">Contact</a> </t> &nbsp; </td> </tr> @@ -659,12 +660,14 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:20px;text-align:center"> &nbsp; - <a style="color:#fff" href="/page/contactus">Contact Us</a> | - <t t-if="website.social_facebook"> - <a style="color:#fff" t-att-href="website.social_facebook">Facebook</a> | - </t> - <t t-if="website.social_twitter"> - <a style="color:#fff" t-att-href="website.social_twitter">Twitter</a> | + <t t-if="website"> + <a style="color:#fff" href="/page/contactus">Contact Us</a> | + <t t-if="website.social_facebook"> + <a style="color:#fff" t-att-href="website.social_facebook">Facebook</a> | + </t> + <t t-if="website.social_twitter"> + <a style="color:#fff" t-att-href="website.social_twitter">Twitter</a> | + </t> </t> <a href="/unsubscribe_from_list" style="color:#fff">Unsubscribe</a> &nbsp; diff --git a/addons/mass_mailing/views/theme/zenflat_snippets.xml b/addons/mass_mailing/views/theme/zenflat_snippets.xml index 1f8f5bf1011..a64f3809154 100644 --- a/addons/mass_mailing/views/theme/zenflat_snippets.xml +++ b/addons/mass_mailing/views/theme/zenflat_snippets.xml @@ -10,7 +10,7 @@ <tr> <td valign="center" style="text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px" alt="Your Logo" /> </a> &nbsp; @@ -28,7 +28,7 @@ <tr> <td style="font-web_editor/font_to_img: 30px; text-align:center"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color:#008000"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color:#008000"> <strong>Your Company</strong> </a> &nbsp; @@ -45,13 +45,13 @@ <tr> <td valign="center" width="270" style="padding:10px 10px 10px 5px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none"> <img src="/logo.png" style="padding:10px;height:auto;max-width:600px" alt="Your Logo" /> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -95,13 +95,13 @@ <tr> <td valign="center" width="270" style="padding-left:5px;font-size:30px"> &nbsp; - <a t-att-href="(website.company_id.website) or '#'" style="text-decoration:none;color: #008000"> + <a t-att-href="(company_id.website) or '#'" style="text-decoration:none;color: #008000"> <strong>Your Company</strong> </a> &nbsp; </td> <td valign="center" width="270" style="padding:10px 15px 10px 10px;vertical-align:middle"> - <table border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> + <table t-if="website" border="0" cellpadding="0" cellspacing="0" align="right" style="border-collapse:collapse"> <tr> <t t-if="website.social_facebook"> <td align="right"> @@ -249,7 +249,7 @@ </ul> </td> <td style="width: 60px;vertical-align:middle;display: table-cell"> - <ul style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> + <ul t-if="website" style="border-left:1px solid #e6e6e6;list-style-type:none;padding-left:16px"> <t t-if="website.social_facebook"> <li style="width:33%;margin-left:0"> <a t-att-href="website.social_facebook"> @@ -259,14 +259,14 @@ </t> <t t-if="website.social_twitter"> <li style="width:34%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_twitter"> <span style="color: rgb(75,110,168);" class="fa fa-twitter-square fa-2x"></span> </a> </li> </t> <t t-if="website.social_googleplus"> <li style="width:33%;margin-left:0"> - <a t-att-href="website.social_facebook"> + <a t-att-href="website.social_googleplus"> <span style="color: rgb(221,75,57);" class="fa fa-google-plus-square fa-2x"></span> </a> </li> @@ -486,7 +486,7 @@ <table style="width:100%;text-align:justify;margin:0 auto;color:#414141;border-collapse:collapse"> <tr> <td style="padding:10px 30px;font-size:14px"> - <p style="margin:0">Dear John</p> + <p style="margin:0">Dear ${object.name}</p> <p style="margin:0">Great stories have personality. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.<br/></p> <p style="margin:0">Great stories are for everyone even when only written for just one person. If you try to write with a wide general audience in mind, your story will ring false and be bland. No one will be interested. Write for one person. If it’s genuine for the one, it’s genuine for the rest.</p> <p style="margin:0">Kind Regards,</p> @@ -606,7 +606,7 @@ </xpath> <xpath expr="//div[@id='email_designer_default_footer']/div[2]" position="inside"> - <div name="Social + Text" class="zenflat o_mail_block_footer_social"> + <div t-if="website" name="Social + Text" class="zenflat o_mail_block_footer_social"> <div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #EEEEEE repeat top /100%;color:#414141"> <div style="padding:10px"> <table cellspacing="0" cellpadding="0" style="margin: 0 auto;width:600px;border-collapse:collapse"> @@ -657,7 +657,8 @@ <tr> <td style="font-size:12px;text-align:center;padding-top:10px;padding-bottom:5px;color:#414141"> &nbsp; - <a style="color:#414141" href="/unsubscribe_from_list">Unsubscribe</a> | <a style="color:#414141" href="/page/contactus">Contact</a> + <a style="color:#414141" href="/unsubscribe_from_list">Unsubscribe</a> + <t t-if="website"> | <a style="color:#414141" href="/page/contactus">Contact</a> </t> &nbsp; </td> </tr> @@ -679,12 +680,14 @@ <tr> <td valign="middle" align="right" style="font-size:12px;padding:20px;text-align:center"> &nbsp; - <a style="color:#414141" href="/page/contactus">Contact Us</a> | - <t t-if="website.social_facebook"> - <a style="color:#414141" t-att-href="website.social_facebook">Facebook</a> | - </t> - <t t-if="website.social_twitter"> - <a style="color:#414141" t-att-href="website.social_twitter">Twitter</a> | + <t t-if="website"> + <a style="color:#414141" href="/page/contactus">Contact Us</a> | + <t t-if="website.social_facebook"> + <a style="color:#414141" t-att-href="website.social_facebook">Facebook</a> | + </t> + <t t-if="website.social_twitter"> + <a style="color:#414141" t-att-href="website.social_twitter">Twitter</a> | + </t> </t> <a href="/unsubscribe_from_list" style="color:#414141">Unsubscribe</a> &nbsp; diff --git a/addons/website_links/__init__.py b/addons/website_links/__init__.py index 12ce74572a7..a064711b06f 100644 --- a/addons/website_links/__init__.py +++ b/addons/website_links/__init__.py @@ -1,3 +1,2 @@ # -*- coding: utf-8 -*- -import models -import controller
\ No newline at end of file +import controller diff --git a/addons/website_links/__openerp__.py b/addons/website_links/__openerp__.py index fd195a0eda1..732ec607791 100644 --- a/addons/website_links/__openerp__.py +++ b/addons/website_links/__openerp__.py @@ -2,14 +2,13 @@ 'name': 'Link Tracker', 'category': 'Hidden', 'description': """ -Create short and trackable URLs. +Website interface to create short and trackable URLs. ===================================================== """, 'version': '1.0', - 'depends':['website','marketing', 'utm'], - 'data' : [ - 'views/website_links.xml', + 'depends': ['website', 'marketing', 'link_tracker'], + 'data': [ 'views/website_links_template.xml', 'views/website_links_graphs.xml', 'security/ir.model.access.csv', diff --git a/addons/website_links/controller/main.py b/addons/website_links/controller/main.py index 46da968a5c4..a91021161e2 100644 --- a/addons/website_links/controller/main.py +++ b/addons/website_links/controller/main.py @@ -10,7 +10,7 @@ class Website_Url(http.Controller): def create_shorten_url(self, **post): if 'url' not in post or post['url'] == '': return {'error': 'empty_url'} - return request.env['website.links'].create(post).read() + return request.env['link.tracker'].create(post).read() @http.route('/r', type='http', auth='user', website=True) def shorten_url(self, **post): @@ -18,28 +18,22 @@ class Website_Url(http.Controller): @http.route('/website_links/add_code', type='json', auth='user') def add_code(self, **post): - link_id = request.env['website.links.code'].search([('code', '=', post['init_code'])], limit=1).link_id.id - new_code = request.env['website.links.code'].search_count([('code', '=', post['new_code']), ('link_id', '=', link_id)]) + link_id = request.env['link.tracker.code'].search([('code', '=', post['init_code'])], limit=1).link_id.id + new_code = request.env['link.tracker.code'].search_count([('code', '=', post['new_code']), ('link_id', '=', link_id)]) if new_code > 0: return new_code.read() else: - return request.env['website.links.code'].create({'code': post['new_code'], 'link_id': link_id})[0].read() + return request.env['link.tracker.code'].create({'code': post['new_code'], 'link_id': link_id})[0].read() @http.route('/website_links/recent_links', type='json', auth='user') def recent_links(self, **post): - return request.env['website.links'].recent_links(post['filter'], post['limit']) + return request.env['link.tracker'].recent_links(post['filter'], post['limit']) @http.route('/r/<string:code>+', type='http', auth="user", website=True) def statistics_shorten_url(self, code, **post): - code = request.env['website.links.code'].search([('code', '=', code)], limit=1) + code = request.env['link.tracker.code'].search([('code', '=', code)], limit=1) if code: return request.website.render("website_links.graphs", code.link_id.read()[0]) else: return werkzeug.utils.redirect('', 301) - - @http.route('/r/<string:code>', type='http', auth='none', website=True) - def full_url_redirect(self, code, **post): - request.env['website.links.click'].add_click(code, request.httprequest.remote_addr, request.session['geoip'].get('country_code'), stat_id=False) - redirect_url = request.env['website.links'].get_url_from_code(code) - return werkzeug.utils.redirect(redirect_url or '', 301) diff --git a/addons/website_links/security/ir.model.access.csv b/addons/website_links/security/ir.model.access.csv index 56f1e1dd457..6e1368eb93d 100644 --- a/addons/website_links/security/ir.model.access.csv +++ b/addons/website_links/security/ir.model.access.csv @@ -1,10 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_website_links_user,website.links,model_website_links,base.group_user,1,0,0,0 -access_website_links_manager,website.links,model_website_links,base.group_website_designer,1,1,1,1 -access_website_links_public,website.links,model_website_links,base.group_public,1,0,0,0 -access_website_links_code_user,website.links.code,model_website_links_code,base.group_user,1,0,0,0 -access_website_links_code_manager,website.links.code,model_website_links_code,base.group_website_designer,1,1,1,1 -access_website_links_code_public,website.links.code,model_website_links_code,base.group_public,1,0,0,0 -access_website_links_click_user,website.links.click,model_website_links_click,base.group_user,1,0,0,0 -access_website_links_click_manager,website.links.click,model_website_links_click,base.group_website_designer,1,1,1,1 -access_website_links_click_public,website.links.click,model_website_links_click,base.group_public,1,0,0,0 +access_link_tracker_manager,link.tracker,link_tracker.model_link_tracker,base.group_website_designer,1,1,1,1 +access_link_tracker_code_manager,link.tracker.code,link_tracker.model_link_tracker_code,base.group_website_designer,1,1,1,1 +access_link_tracker_click_manager,link.tracker.click,link_tracker.model_link_tracker_click,base.group_website_designer,1,1,1,1 diff --git a/addons/website_links/static/src/js/website_links_charts.js b/addons/website_links/static/src/js/website_links_charts.js index 70f689c0454..3db653b688b 100644 --- a/addons/website_links/static/src/js/website_links_charts.js +++ b/addons/website_links/static/src/js/website_links_charts.js @@ -131,7 +131,7 @@ website.if_dom_contains('div.o_website_links_chart', function() { // Get the code of the link var link_id = $('#link_id').val(); - var clicks = new Model('website.links.click'); + var clicks = new Model('link.tracker.click'); var links_domain = ['link_id', '=', parseInt(link_id)]; var total_clicks = function() { diff --git a/addons/website_mass_mailing/__init__.py b/addons/website_mass_mailing/__init__.py new file mode 100644 index 00000000000..0c5de3a1093 --- /dev/null +++ b/addons/website_mass_mailing/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +import controllers diff --git a/addons/website_mass_mailing/__openerp__.py b/addons/website_mass_mailing/__openerp__.py new file mode 100644 index 00000000000..471bc0f985a --- /dev/null +++ b/addons/website_mass_mailing/__openerp__.py @@ -0,0 +1,16 @@ +{ + 'name': 'Website Mass Mailing Campaigns', + 'description': """ +Add a snippet in the website builder to subscribe a mass_mailing list + """, + 'version': '1.0', + 'author': 'Odoo', + 'category': 'Hidden', + 'depends': ['website', 'mass_mailing'], + 'data': [ + 'views/website_mass_mailing.xml', + 'views/unsubscribe.xml', + 'views/snippets.xml', + ], + 'auto_install': True, +} diff --git a/addons/website_mass_mailing/controllers/__init__.py b/addons/website_mass_mailing/controllers/__init__.py new file mode 100644 index 00000000000..bbd183e955b --- /dev/null +++ b/addons/website_mass_mailing/controllers/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +import main diff --git a/addons/website_mass_mailing/controllers/main.py b/addons/website_mass_mailing/controllers/main.py new file mode 100644 index 00000000000..49ca5d5f1a1 --- /dev/null +++ b/addons/website_mass_mailing/controllers/main.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +from openerp import http, SUPERUSER_ID +from openerp.http import request + + +class MassMailController(http.Controller): + + @http.route(['/mail/mailing/<int:mailing_id>/unsubscribe'], type='http', website=True, auth='none') + def mailing(self, mailing_id, email=None, res_id=None, **post): + mailing = request.env['mail.mass_mailing'].sudo().browse(mailing_id) + if mailing.exists(): + if mailing.mailing_model == 'mail.mass_mailing.contact': + contacts = request.env['mail.mass_mailing.contact'].sudo().search([('email', 'ilike', email)]) + return request.website.render('mass_mailing.page_unsubscribe', { + 'contacts': contacts, + 'email': email, + 'mailing_id': mailing_id}) + else: + mailing.update_opt_out(mailing_id, email, [res_id], True) + return request.website.render('mass_mailing.page_unsubscribed') + + @http.route(['/mail/mailing/unsubscribe'], type='json', auth='none') + def unsubscribe(self, mailing_id, opt_in_ids, opt_out_ids, email): + mailing = request.env['mail.mass_mailing'].sudo().browse(mailing_id) + if mailing.exists(): + mailing.update_opt_out(mailing_id, email, opt_in_ids, False) + mailing.update_opt_out(mailing_id, email, opt_out_ids, True) + + @http.route('/website_mass_mailing/is_subscriber', type='json', website=True, auth="public") + def is_subscriber(self, list_id, **post): + cr, uid, context = request.cr, request.uid, request.context + Contacts = request.registry['mail.mass_mailing.contact'] + Users = request.registry['res.users'] + + is_subscriber = False + email = None + if uid != request.website.user_id.id: + email = Users.browse(cr, SUPERUSER_ID, uid, context).email + elif request.session.get('mass_mailing_email'): + email = request.session['mass_mailing_email'] + + if email: + contact_ids = Contacts.search(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email), ('opt_out', '=', False)], context=context) + is_subscriber = len(contact_ids) > 0 + + return {'is_subscriber': is_subscriber, 'email': email} + + @http.route('/website_mass_mailing/subscribe', type='json', website=True, auth="public") + def subscribe(self, list_id, email, **post): + cr, uid, context = request.cr, request.uid, request.context + Contacts = request.registry['mail.mass_mailing.contact'] + + contact_ids = Contacts.search_read(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email)], ['opt_out'], context=context) + if not contact_ids: + Contacts.add_to_list(cr, SUPERUSER_ID, email, int(list_id), context=context) + else: + if contact_ids[0]['opt_out']: + Contacts.write(cr, SUPERUSER_ID, [contact_ids[0]['id']], {'opt_out': False}, context=context) + # add email to session + request.session['mass_mailing_email'] = email + return True + + @http.route(['/website_mass_mailing/get_content'], type='json', website=True, auth="public") + def get_mass_mailing_content(self, newsletter_id, **post): + data = self.is_subscriber(newsletter_id, **post) + mass_mailing_list = request.registry['mail.mass_mailing.list'].browse(request.cr, SUPERUSER_ID, int(newsletter_id), request.context) + data.update({ + 'content': mass_mailing_list.popup_content, + 'redirect_url': mass_mailing_list.popup_redirect_url + }) + return data diff --git a/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js b/addons/website_mass_mailing/static/src/js/website_mass_mailing.editor.js index eced083d6d0..eced083d6d0 100644 --- a/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js +++ b/addons/website_mass_mailing/static/src/js/website_mass_mailing.editor.js diff --git a/addons/mass_mailing/static/src/js/website_mass_mailing.js b/addons/website_mass_mailing/static/src/js/website_mass_mailing.js index 2d0760a202a..2d0760a202a 100644 --- a/addons/mass_mailing/static/src/js/website_mass_mailing.js +++ b/addons/website_mass_mailing/static/src/js/website_mass_mailing.js diff --git a/addons/mass_mailing/views/snippets.xml b/addons/website_mass_mailing/views/snippets.xml index 14757594900..14757594900 100644 --- a/addons/mass_mailing/views/snippets.xml +++ b/addons/website_mass_mailing/views/snippets.xml diff --git a/addons/mass_mailing/views/unsubscribe.xml b/addons/website_mass_mailing/views/unsubscribe.xml index 606dbabe51d..11d6de1213f 100644 --- a/addons/mass_mailing/views/unsubscribe.xml +++ b/addons/website_mass_mailing/views/unsubscribe.xml @@ -59,13 +59,13 @@ <template id="page_unsubscribe" name="Unsubscribe"> <t t-call="website.layout"> - <t t-call="mass_mailing.unsubscribe"/> + <t t-call="website_mass_mailing.unsubscribe"/> </t> </template> <template id="page_unsubscribed" name="Unsubscribed"> <t t-call="website.layout"> - <t t-call="mass_mailing.unsubscribed"/> + <t t-call="website_mass_mailing.unsubscribed"/> </t> </template> </data> diff --git a/addons/mass_mailing/views/website_mass_mailing.xml b/addons/website_mass_mailing/views/website_mass_mailing.xml index 777f9edc9cb..ad5d201343a 100644 --- a/addons/mass_mailing/views/website_mass_mailing.xml +++ b/addons/website_mass_mailing/views/website_mass_mailing.xml @@ -4,13 +4,13 @@ <template id="assets_frontend" inherit_id="website.assets_frontend" name="Mail Frontend Assets"> <xpath expr="." position="inside"> - <script type="text/javascript" src="/mass_mailing/static/src/js/website_mass_mailing.js"></script> + <script type="text/javascript" src="/website_mass_mailing/static/src/js/website_mass_mailing.js"></script> </xpath> </template> <template id="assets_editor" inherit_id="website.assets_editor" name="wesbite_mass_mailing Editor assets"> <xpath expr="/t" position="inside"> - <script type="text/javascript" src="/mass_mailing/static/src/js/website_mass_mailing.editor.js" groups="base.group_website_publisher"></script> + <script type="text/javascript" src="/website_mass_mailing/static/src/js/website_mass_mailing.editor.js" groups="base.group_website_publisher"></script> </xpath> </template> |
