diff --git a/addons/website_mass_mailing_sms/__init__.py b/addons/website_mass_mailing_sms/__init__.py new file mode 100644 index 00000000000..dd15b5c32e5 --- /dev/null +++ b/addons/website_mass_mailing_sms/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import controllers diff --git a/addons/website_mass_mailing_sms/__manifest__.py b/addons/website_mass_mailing_sms/__manifest__.py new file mode 100644 index 00000000000..c967db7edd8 --- /dev/null +++ b/addons/website_mass_mailing_sms/__manifest__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +{ + 'name': 'Newsletter Subscribe SMS Template', + 'summary': 'Attract visitors to subscribe to mailing lists', + 'description': """ +This module adds a new template to the Newsletter Block to allow +your visitors to subscribe with their phone number. + """, + 'version': '1.0', + 'category': 'Website/Website', + 'depends': ['website_mass_mailing', 'mass_mailing_sms'], + 'data': [ + 'views/snippets/snippets_templates.xml', + 'data/ir_model_data.xml', + ], + 'auto_install': True, + 'license': 'LGPL-3', +} diff --git a/addons/website_mass_mailing_sms/controllers/__init__.py b/addons/website_mass_mailing_sms/controllers/__init__.py new file mode 100644 index 00000000000..5d4b25db9c0 --- /dev/null +++ b/addons/website_mass_mailing_sms/controllers/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import main diff --git a/addons/website_mass_mailing_sms/controllers/main.py b/addons/website_mass_mailing_sms/controllers/main.py new file mode 100644 index 00000000000..8384aa31323 --- /dev/null +++ b/addons/website_mass_mailing_sms/controllers/main.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.http import request +from odoo.addons.mass_mailing.controllers import main + + +class MassMailController(main.MassMailController): + + def _get_value(self, subscription_type): + value = super(MassMailController, self)._get_value(subscription_type) + if not value and subscription_type == 'mobile': + if not request.env.user._is_public(): + value = request.env.user.partner_id.mobile + elif request.session.get('mass_mailing_mobile'): + value = request.session['mass_mailing_mobile'] + return value + + def _get_fname(self, subscription_type): + value_field = super(MassMailController, self)._get_fname(subscription_type) + if not value_field and subscription_type == 'mobile': + value_field = 'mobile' + return value_field diff --git a/addons/website_mass_mailing_sms/data/ir_model_data.xml b/addons/website_mass_mailing_sms/data/ir_model_data.xml new file mode 100644 index 00000000000..3209cabe768 --- /dev/null +++ b/addons/website_mass_mailing_sms/data/ir_model_data.xml @@ -0,0 +1,11 @@ + + + + + mailing.contact + + + + diff --git a/addons/website_mass_mailing_sms/views/snippets/snippets_templates.xml b/addons/website_mass_mailing_sms/views/snippets/snippets_templates.xml new file mode 100644 index 00000000000..f9ccb8b86d9 --- /dev/null +++ b/addons/website_mass_mailing_sms/views/snippets/snippets_templates.xml @@ -0,0 +1,29 @@ + + + + + + + +