OpenERP 6.1 - 电子邮件模板默认为 html

标签 openerp

我正在尝试使用右侧面板上的“发送邮件”菜单从合作伙伴窗口发送电子邮件。 为此,我从配置菜单创建了一个模板电子邮件,将正文(文本)留空并在正文(Rich/html)中填充:

<p>Some text in <b>bold</b></p>

当我从合作伙伴表单运行发送邮件时,邮件正文非常空,看起来邮件正文默认为电子邮件模板中的正文(文本)选项卡。

当我查看表 email_template 时确认了这一点,其中字段子类型始终为“Plain”。

我尝试通过将域值设置为 [('subtype','=','html')] 来设置特定于我的电子邮件模板的操作窗口,但它没有改变任何内容。我还将这段代码添加到大多数与电子邮件相关的操作窗口域中,但它也没有改变任何内容。

有谁知道如何从 OpenERP 默认发送 HTML 格式的电子邮件?

UPDATE: Has anyone got a sample of HTML code that works for them, meaning they receive correctly in their email client?

My issue is that if I leave the Plain Text empty within the template and have some html tags under the Rich/html, then I receive an email in format html, but it is always empty. Even the source is totally empty. I suppose there is something wrong with my html syntax. Maybe I need to double the "/" in a closing paragraph as it may be an escape character somewhere, somehow. I have tried a lots of different syntaxes but apparently not the right one.

So if someone out there had some html coding that works for them and they'd be happy to share, thanks in advance!

UPDATE 2, I have created an html template email after a quick training on the internet. I have tested my bit of code with litmus and it shows exactly what I wanted to see. I then paste this exact same bit of code into OpenERP, send the email message to my email client, identical to the one on litmus, and it is totally empty. However, it says the format is HTML. There is definitely an issue somewhere but I can't point out where. It seems OpenERP doesn't send the html code. Has anyone ever had the same issue???

Here is the html basic code I have used for testing and that I pasted into OpenERP:

<html>
<body leftmargin="0" marginwidth="0" marginheight="0" offset="0">
    <table width="100%" bgcolor="#cccccc" cellpading="10" cellspacing="10">
        <tr valign="top" align="center">
            <td>
                <table width="500" bgcolor="#ffffff" cellpading="0" cellspacing="0">
                    <tr>
                        <td>
                                liusuhflsb
                        </td>
                    </tr>
                </table>
            </td>
        </tr>       
    </table>
</body>
</html>

最佳答案

简答:如果不使用第三方插件或自定义代码,您无法在 6.1 中执行此操作。

长答案:
OpenERP 6.1 不提供开箱即用的所见即所得/富文本编辑器(OpenERP 7.0 引入了)

因此,在 6.1 中,只要用户可以手动编辑电子邮件内容,就只使用纯文本版本的模板。事实上,要求用户在撰写电子邮件时手动编辑模板 HTML 版本的源代码(不是所见即所得)会很尴尬。 当您通过相应的 Send Mail 侧栏操作基于模板撰写新电子邮件时就是这种情况,因为您可以在发送之前修改电子邮件。

HTML/富文本和纯文本版本的模板都按预期使用的一个典型情况是电子邮件模板绑定(bind)到营销事件步骤(通过 marketing_campaign 模块)- 因为这些电子邮件是在没有任何编辑或任何手动用户操作的情况下发送的。

UPDATE: If that's what you're interested in, Marketing Campaigns will always send both the plain-text and HTML version of your emails automatically, and the recipients' mail software will display the relevant one based on user preferences (for most people it will be the HTML version). However you can not test the templates using the Send Mail sidebar buttons, because that will keep only the plain-text version, as explained above. There are two recommended ways to test those campaign emails:

  1. Use the Preview button on the template and select a sample record to render the template for. This will let you double-check the source of the HTML that will be produced.
  2. Test-drive your campaign putting in "manual" mode: have a dummy record enter the campaign with your email address on it, then use the Campaign Follow-up menu to make it manually advance through the campaign steps. This is really important to validate not only your email templates but also the structure of your campaign. See also this basic introduction to OpenERP Marketing Campaign, from OpenERP Community Days 2012.

有一些社区模块为 OpenERP 6.1 添加了 WYSIWYG 编辑功能(在 WYSIWYG 上搜索 OpenERP Apps),但我不认为它们与 email_template 模块集成是为了启用直接撰写富文本。这样做并不是很难。如果您有兴趣,请先阅读 mail.compose.message 向导的源代码(original version of the mail moduleemail.template extension ),了解模板字段的使用方式和位置.

如果您不熟悉 OpenERP 开发,developer documentation OpenERP 和 technical memento将是有趣的起点。

关于OpenERP 6.1 - 电子邮件模板默认为 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14302779/

相关文章:

python - 在域过滤器中使用函数

openerp - 使用 xmlrpc 更新产品字段 "Quantity On Hand"

openerp - odoo中的模板继承

ubuntu - Jasper_Report_Module 与 Odoo 8 兼容吗?

webkit - 使用 wkhtmltopdf 可变页面高度

openerp - 如何在表单界面为 OpenERP v7 设置默认值

android - 无法访问 XmlRpcController ,XmlRpcHttpRequestConfig

docker - 使用 Docker 在 Odoo 上设置 LDAP

python - 我想比较叶子持续时间的日期与odoo python中的当前日期

python - openerp 安排服务器 Action