如何在odoo的电子邮件模板中获取用户公司和管理员的电子邮件ID
How to get the email id of user company and administrator in email template in odoo
目前我正在开发一个预订房间的模块。当用户预订房间时,应向管理员发送一封自动邮件。为此,我需要在我的电子邮件模板中获取用户公司的电子邮件 ID 和管理员电子邮件 ID。我该怎么做。
这是我的模板..
<record id="send_request" model="email.template">
<field name="name">Request Notification</field>
<field name="email_from">${ }</field>
<field name="subject">Room request </field>
<field name="email_to" >${ }</field>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>STPI Room Request </title>
<style>
span.oe_mail_footer_access {
display:block;
text-align:center;
color:grey;
}
</style>
</head>
<body>
<p>
Dear Sir,
</p>
<br> <p>My company, ${ } would like to use the Room for the specified duration. Kindly concider our request for the use of conference/board room.</p>
<br/>
<p>
Thanks and Regards,
<br/>
${ }
</p>
</body>
</html>
]]>
</field>
</record>
在 email_from 中,我需要获取用户公司电子邮件 ID,在 email_to 中,我需要获取管理员电子邮件 ID。
具有 对象 的电子邮件模板,它是整个电子邮件模板的全局实体。
您可以获得该对象作为附加到它的电子邮件模板的当前模型。
这意味着您可以获得基于您的特定模型的
model_id 属性。
例如:
<field name="model_id" ref="sale.model_sale_order"/>
听说您可以获得 对象 作为 sale.order 模型,因此需要为此添加单独的逻辑。
对于该对象,您可以访问与该模块相关的所有字段(如 sale.order)
喜欢..
object.user_id.email
object.company_id.email 等等..
您还可以参考 sale.order 模板以及插件模块中的更多内容
希望我的回答对您有所帮助:)
您好,您可以这样使用。
因为当你这样使用时,它会从你当前的对象中获取电子邮件 ID。
${object.email_id_field_name}
目前我正在开发一个预订房间的模块。当用户预订房间时,应向管理员发送一封自动邮件。为此,我需要在我的电子邮件模板中获取用户公司的电子邮件 ID 和管理员电子邮件 ID。我该怎么做。
这是我的模板..
<record id="send_request" model="email.template">
<field name="name">Request Notification</field>
<field name="email_from">${ }</field>
<field name="subject">Room request </field>
<field name="email_to" >${ }</field>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>STPI Room Request </title>
<style>
span.oe_mail_footer_access {
display:block;
text-align:center;
color:grey;
}
</style>
</head>
<body>
<p>
Dear Sir,
</p>
<br> <p>My company, ${ } would like to use the Room for the specified duration. Kindly concider our request for the use of conference/board room.</p>
<br/>
<p>
Thanks and Regards,
<br/>
${ }
</p>
</body>
</html>
]]>
</field>
</record>
在 email_from 中,我需要获取用户公司电子邮件 ID,在 email_to 中,我需要获取管理员电子邮件 ID。
具有 对象 的电子邮件模板,它是整个电子邮件模板的全局实体。
您可以获得该对象作为附加到它的电子邮件模板的当前模型。 这意味着您可以获得基于您的特定模型的 model_id 属性。
例如:
<field name="model_id" ref="sale.model_sale_order"/>
听说您可以获得 对象 作为 sale.order 模型,因此需要为此添加单独的逻辑。
对于该对象,您可以访问与该模块相关的所有字段(如 sale.order)
喜欢..
object.user_id.email
object.company_id.email 等等..
您还可以参考 sale.order 模板以及插件模块中的更多内容
希望我的回答对您有所帮助:)
您好,您可以这样使用。 因为当你这样使用时,它会从你当前的对象中获取电子邮件 ID。
${object.email_id_field_name}