How to use conditional email addresses in Odoo v17 email templates
In this article we will show you how to use conditional email addresses in email templates in OdooOdoo is a modular open source ERP system that supports companies of all sizes with digitalization. It combines numerous business applications such as CRM, accounting, warehouse, project management, HR, helpdesk and webshop in one platform. What exactly is Odoo? Odoo is a flexible business software that can be used to digitally map all important company processes - from customer management... v17.
Often you want to make sure that emails are sent to the right address depending on whether a certain field is filled in or not.
In this case, we combine custom fields and standard fields to create a reliable solution.
Step-by-step instructions
1. create the user-defined field Rechnungsemail
:
- Navigate to Odoo
Odoo is a modular open source ERP system that supports companies of all sizes with digitalization. It combines numerous business applications such as CRM, accounting, warehouse, project management, HR, helpdesk and webshop in one platform. What exactly is Odoo? Odoo is a flexible business software that can be used to digitally map all important company processes - from customer management... Studio by clicking on “Studio” in the main menu.
- Select the “Partner” or “Contact” model (depending on how it is labeled in your Odoo
Odoo is a modular open source ERP system that supports companies of all sizes with digitalization. It combines numerous business applications such as CRM, accounting, warehouse, project management, HR, helpdesk and webshop in one platform. What exactly is Odoo? Odoo is a flexible business software that can be used to digitally map all important company processes - from customer management... instance).
- Click on “Add field” and create a new field of the type “Email”.
- Name the field
Rechnungsemail
.
The technical name of the field is automatically set asx_studio_rechnungsemail
. - Save and activate the new field.
2. open Odoo and navigate to the e-mail templates:
- Go to “Settings” and select “Email” or “Technical settings” (depending on your Odoo
Odoo is a modular open source ERP system that supports companies of all sizes with digitalization. It combines numerous business applications such as CRM, accounting, warehouse, project management, HR, helpdesk and webshop in one platform. What exactly is Odoo? Odoo is a flexible business software that can be used to digitally map all important company processes - from customer management... version and your user rights).
- Search for “Email templates” and open the template you want to customize.
3. find the field for the e-mail address:
- In the “Advanced settings” area or directly in the template editor, you will find the
email_to
field.
This field determines the address to which the email is sent.
4. use the following code in the field email_to
:
{{ object.partner_id.x_studio_rechnungsemail if object.partner_id.x_studio_rechnungsemail != '' else object.partner_id.email }}
- This code checks whether the user-defined field
x_studio_rechnungsemail
is not empty.
If this field is filled in, its value is used.
If it is empty, the partner’s default fieldemail
is used instead.
5. save the changes:
- Click on “Save” to apply the changes to your email template.
Explanation of the code
object.partner_id.x_studio_rechnungsemail
: Here we access the user-defined field x_studio_rechnungsemail
of the partner. if object.partner_id.x_studio_rechnungsemail != ''
The condition checks whether this field is not empty. else object.partner_id.email
If the user-defined field is empty, the standard field email
of the partner.
Advantages of this method
- Flexibility: You can use different e-mail addresses based on specific conditions.
- Fault tolerance: If a user-defined field is empty, an alternative address is automatically used.
- Easy maintenance: The code is clear and easy to understand, which makes future adjustments easier.
Conclusion
With this simple but effective approach, you can ensure that your emails are always sent to the right address.
Using conditional expressions in OdooOdoo is a modular open source ERP system that supports companies of all sizes with digitalization. It combines numerous business applications such as CRM, accounting, warehouse, project management, HR, helpdesk and webshop in one platform. What exactly is Odoo? Odoo is a flexible business software that can be used to digitally map all important company processes - from customer management... email templates gives you the flexibility you need for efficient communication.
We hope this guide helps you get the most out of your email templates in OdooOdoo is a modular open source ERP system that supports companies of all sizes with digitalization. It combines numerous business applications such as CRM, accounting, warehouse, project management, HR, helpdesk and webshop in one platform. What exactly is Odoo? Odoo is a flexible business software that can be used to digitally map all important company processes - from customer management... v17.
If you have any further questions or comments, please do not hesitate to contact the noprob.it team!
Feel free to publish this article on your blog or forward it to your colleagues.
At noprob.it we always strive to provide you with the best tips and tricks for your OdooOdoo is a modular open source ERP system that supports companies of all sizes with digitalization. It combines numerous business applications such as CRM, accounting, warehouse, project management, HR, helpdesk and webshop in one platform. What exactly is Odoo? Odoo is a flexible business software that can be used to digitally map all important company processes - from customer management... implementation!
Dieser Beitrag ist auch verfügbar auf:
Deutsch (German)
Leave A Comment?