Files
odoo_source/addons/website_mass_mailing_sms/controllers/main.py
T
Patrick Hoste ee90b7e551 [ADD] website_mass_mailing_sms: new module adding template to newsletter snippet
PURPOSE

This commit adds a new bridge module that allows one to select the SMS Template
for the newsletter block snippets that allows the user to enter his mobile phone
and get the latest news via mobile text.

LINKS

Task-2672194

Part-of: odoo/odoo#79582
2022-09-01 17:10:52 +02:00

24 lines
925 B
Python

# -*- 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