Files
odoo_source/addons/website_mail/controllers/email_designer.py
T
Thibault Delavallée 271e805cb8 [IMP] mass_mailing: new refactoring of the way the body is managed
- now body_html is a right field on mass_mailing, editable using the website
- email_designer controller / template now works on everything that has a body
receiving its model and res_id as post parameters; it does not work only on
email tempaltes anymore
- cleaning of the mass mailing form view: reply_to managment option (either
replied go into the document, either there is a specified reply_to; it is implemented
using boolean fields instead of a selection because all options are not available
for all models ... models like contact or partner do not have a chatter or
shoudl be be used for a chatter-like use)
- send to all now instantiates a mail.compose.message; the mass mailign processing
is delegated to the wizard itself.

bzr revid: tde@openerp.com-20140407170346-hpklabi513xskd07
2014-04-07 19:03:46 +02:00

30 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
class WebsiteEmailDesigner(http.Controller):
@http.route('/website_mail/email_designer', type='http', auth="user", website=True, multilang=True)
def index(self, model=None, res_id=None, **kw):
if not model or not model in request.registry or not res_id:
return request.redirect('/')
if not 'body' in request.registry[model]._all_columns and not 'body_html' in request.registry[model]._all_columns:
return request.redirect('/')
obj_ids = request.registry[model].exists(request.cr, request.uid, [res_id], context=request.context)
if not obj_ids:
return request.redirect('/')
values = {
'object': request.registry[model].browse(request.cr, request.uid, obj_ids[0], context=request.context),
'model': request.registry[model],
'model_name': model,
'res_id': res_id,
}
return request.website.render("website_mail.designer_index", values)
@http.route(['/website_mail/snippets'], type='json', auth="user", website=True)
def snippets(self):
return request.website._render('website_mail.email_designer_snippets')