email_template is a default module of OpenERP which is used to send emails from OpenERP. It is much easier than smtp_client and the template of the mail can be easily customized. We can configure outgoing email server and template of email_template from Setting > Configuration > Email. The outgoing mail server of email_template can be configured from “Outgoing Mail Servers” in Setting > Configuration > Email. The following is a screenshot of configuring outgoing mail server in email_template.
In outgoing mail server menu, there are some mandatory fields which has to be configured by the user. These parameters are used to configure the mail server.
Another important feature of email_template is the Template which can be found in Setting > Configuration > Email > Template. This is used to specify the format in which the email has to be send. A screenshot of the Template in email_template is shown below:
In template, we can set
In Email Detail Tab, we can set:
Body of the email can be either plain text or an HTML format. In plain text the body can be created using the plain text format and in HTML we can create the mail body in HTML. We also have the freedom to select the language in which the mail is to be send. This is specified in Language selection field in Email Detail Tab.
Another main feature of email_template is the freedom to dynamically specify the field values like From, To, etc. The mail template can be customized any time without modifying the code. Even a person without technical expertise in OpenERP coding can set the fields using Dynamic Value Builder.
Dynamic Value Builder consist of following fields:
In Advanced tab, We can select
In this tab, we have an option to attach files to email. We can see an button Add Sidebar Button. This creates a button in sidebar in the related document model form view which helps in sending email any time from the form view. For example I have created a template for the sale.order and a sidebar button is created by clicking “Add Sidebar Button” button in template, a new button will be created as shown below:
When this button is clicked, a window pops up using which we can send email as shown below:
There can be situation in which client want to send email when a particular button is clicked. For example if a client want to send a mail to the hr manager when a leave application by an employee has been confirmed. For this create a template for hr_holidays model, inherit the button action to confirm the leave from which the mail has to be send, Search and find the id of the template using which the mail has to be send, call the function send_mail in email_template and pass the arguments like template id, resource id to it. Mail will be send every time the button is clicked.
Marie: Hello, First of all thanks for your post!!! I have an issue with a template for meeting as I would like to send the mail to all attendees and not just to the partner contact. the object I take is ${object.attendee_ids} and the result is [browse_record(calendar.attendee, 148), browse_record(calendar.attendee, 149)] I need to get the emails of the attendee but don't know how to do this as it's a many2many field. Could you help me with this? I'm using openerp 6.1 Many Thanks MN ".
Leave a Reply