set of fields that we try to edit (body_html and body for body, email_from and email for email-from, name and subject for subject), because t-field is not dynamic. If the model that should be edited does not hold those fields, the mail editor won't work. Also fixed editor not being actiated when going into the body edition. bzr revid: tde@openerp.com-20140416105901-vavkh9erjsq4mof9
20 lines
591 B
Python
20 lines
591 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from openerp.osv import osv
|
|
from openerp.tools.translate import _
|
|
|
|
|
|
class EmailTemplate(osv.Model):
|
|
_inherit = 'email.template'
|
|
|
|
def action_edit_html(self, cr, uid, ids, context=None):
|
|
if not len(ids) == 1:
|
|
raise ValueError('One and only one ID allowed for this action')
|
|
url = '/website_mail/email_designer?model=email.template&res_id=%d&enable_editor=1' % (ids[0],)
|
|
return {
|
|
'name': _('Edit Template'),
|
|
'type': 'ir.actions.act_url',
|
|
'url': url,
|
|
'target': 'self',
|
|
}
|