SlideShare a Scribd company logo
1 of 13
www.cybrosys.com
Email Aliasing in Odoo
INTRODUCTION
• Email aliasing is a default feature in Odoo which allows the user to fetch contents to ERP records directly from
incoming emails. The feature is a type of automation. Since we can configure the E-mails to fetch contents
directly; it reduces the human effort and simplifies the business process.
 To do so we have to follow the following steps.
1. Configure default alias name and alias domain
2. Create a record in model ‘Aliases’
3. Change ‘message_new’ global function according to your need
4. Configure incoming mail with an Action
 Configure default alias name and alias domain
 The first step is to configure the default alias name and domain. We can fetch the alias
domain from ir.config_parameter. To perform these two tasks, we have to add following
fields.
alias_prefix = fields.Char('Default Alias Name)
alias_domain = fields.Char('Alias Domain', default=lambda self:
self.env["ir.config_parameter"].get_param("mail.catchall.domain"))
 For eg:- Suppose we need to fetch emails from the mail id ‘leave_request@cybrosys.in’.
So here Alias name is ‘leave_request’ and alias domain is ‘cybrosys.in’.
We have to set default alias domain in general settings. For that, go to
Settings -> General Settings
And provide alias domain in the field.
 Create a record in model ‘Aliases’
 The second step is to create a record in ‘Aliases’ model. For that, we have to add an XML file
as follow.
<record id="mail_alias_leave" model="mail.alias">
<field name="alias_name">leave</field>
<field name="alias_model_id" ref="model_hr_holidays"/>
<field name="alias_user_id" ref="base.user_root"/>
<field name="alias_contact">employees</field>
</record>
 Here we have to 'refer' the model in the field ‘alias_model_id’.
This is the model which we need to create the record from our incoming mail. Then we can see this
record from user interface too.
 Go to Settings-> Technical -> Email-> Aliases
 Change ‘message_new’ global function according to the need
 The next step is to modify the global function ‘message_new’ according to the need. Here we can
add parameters which we need to create a record into the dictionary ‘custom_values’.
When we update the ‘custom_values’ dictionary, our record will be created according to that
information.
def message_new(self, msg_dict, custom_values=None):
if custom_values is None:
custom_values = {}
email_address = email_split(msg_dict.get('email_from', False))[0]
user = self.env['res.users'].search([
'|',
('email', 'ilike', email_address))
], limit=1)
msg_subject = msg_dict.get('subject', '')
msg_body = msg_dict.get('body', '')
custom_values.update({
'name': msg_subject.strip(),
'user_id': user.id,
})
return super(HrLeaveAlias, self).message_new(msg_dict, custom_values)
 Here we can find the incoming mail id by using ‘email_split’.
For that, we need to import this library from odoo.tools.
Eg:- from odoo.tools import email_split
 Also we can fetch email subject and body from ‘msg’ parameter.
Eg:- msg_subject = msg_dict.get('subject', '')
msg_body = msg_dict.get('body', '')
 In custom values, we can update any values into the corresponding field.
 Configure incoming mail with an Action
 The final step is to configure the incoming emails with an action.
 Form the label ‘Actions to Perform on Incoming Mails’, we can create actions on
1. Record
2. Server Action
 If we select a record it will automatically create record while clicking on the button ‘Fetch New’. If
we select a server action then it will run while clicking on the button ‘Fetch New’.
Refer this link for more:
https://www.cybrosys.com/blog/email-aliasing-in-odoo
Thank You !
Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park,
Kakkancherry,
Calicut University P.O.
Calicut
Kerala, India - 673635.
Cybrosys Ltd
15, ST Antonys Road,
Forest Gate, London
England,
E79QA.
Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, Kerala,
India-682030.

More Related Content

More from Celine George

More from Celine George (20)

Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales AppHow to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales App
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 

Recently uploaded

Presentation4 (2) survey responses clearly labelled
Presentation4 (2) survey responses clearly labelledPresentation4 (2) survey responses clearly labelled
Presentation4 (2) survey responses clearly labelled
CaitlinCummins3
 
Powerpoint showing results from tik tok metrics
Powerpoint showing results from tik tok metricsPowerpoint showing results from tik tok metrics
Powerpoint showing results from tik tok metrics
CaitlinCummins3
 
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di PasuruanObat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Jakarta Wa 085176963835 Apotek Jual Obat Cytotec Di Jakarta
 
Obat Aborsi Surabaya 0851\7696\3835 Jual Obat Cytotec Di Surabaya
Obat Aborsi Surabaya 0851\7696\3835 Jual Obat Cytotec Di SurabayaObat Aborsi Surabaya 0851\7696\3835 Jual Obat Cytotec Di Surabaya
Obat Aborsi Surabaya 0851\7696\3835 Jual Obat Cytotec Di Surabaya
Obat Aborsi Jakarta Wa 085176963835 Apotek Jual Obat Cytotec Di Jakarta
 
obat aborsi bandung wa 081336238223 jual obat aborsi cytotec asli di bandung9...
obat aborsi bandung wa 081336238223 jual obat aborsi cytotec asli di bandung9...obat aborsi bandung wa 081336238223 jual obat aborsi cytotec asli di bandung9...
obat aborsi bandung wa 081336238223 jual obat aborsi cytotec asli di bandung9...
yulianti213969
 

Recently uploaded (20)

Presentation4 (2) survey responses clearly labelled
Presentation4 (2) survey responses clearly labelledPresentation4 (2) survey responses clearly labelled
Presentation4 (2) survey responses clearly labelled
 
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdfProgress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
 
First Time Home Buyer's Guide - KM Realty Group LLC
First Time Home Buyer's Guide - KM Realty Group LLCFirst Time Home Buyer's Guide - KM Realty Group LLC
First Time Home Buyer's Guide - KM Realty Group LLC
 
Goal Presentation_NEW EMPLOYEE_NETAPS FOUNDATION.pptx
Goal Presentation_NEW EMPLOYEE_NETAPS FOUNDATION.pptxGoal Presentation_NEW EMPLOYEE_NETAPS FOUNDATION.pptx
Goal Presentation_NEW EMPLOYEE_NETAPS FOUNDATION.pptx
 
Solar Panel Installation A Comprehensive Guide.pdf
Solar Panel Installation A Comprehensive Guide.pdfSolar Panel Installation A Comprehensive Guide.pdf
Solar Panel Installation A Comprehensive Guide.pdf
 
Thompson_Taylor_MBBS_PB1_2024-03 (1)- Project & Portfolio 2.pptx
Thompson_Taylor_MBBS_PB1_2024-03 (1)- Project & Portfolio 2.pptxThompson_Taylor_MBBS_PB1_2024-03 (1)- Project & Portfolio 2.pptx
Thompson_Taylor_MBBS_PB1_2024-03 (1)- Project & Portfolio 2.pptx
 
Sex service available my WhatsApp number 7374088497
Sex service available my WhatsApp number 7374088497Sex service available my WhatsApp number 7374088497
Sex service available my WhatsApp number 7374088497
 
Powerpoint showing results from tik tok metrics
Powerpoint showing results from tik tok metricsPowerpoint showing results from tik tok metrics
Powerpoint showing results from tik tok metrics
 
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di PasuruanObat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
 
Unlocking Growth The Power of Outsourcing for CPA Firms
Unlocking Growth The Power of Outsourcing for CPA FirmsUnlocking Growth The Power of Outsourcing for CPA Firms
Unlocking Growth The Power of Outsourcing for CPA Firms
 
Ital Liptz - all about Itai Liptz. news.
Ital Liptz - all about Itai Liptz. news.Ital Liptz - all about Itai Liptz. news.
Ital Liptz - all about Itai Liptz. news.
 
WheelTug Short Pitch Deck 2024 | Byond Insights
WheelTug Short Pitch Deck 2024 | Byond InsightsWheelTug Short Pitch Deck 2024 | Byond Insights
WheelTug Short Pitch Deck 2024 | Byond Insights
 
A DAY IN LIFE OF A NEGOTIATOR By Pondicherry University MBA Students.pptx
A DAY IN LIFE OF A NEGOTIATOR By Pondicherry University MBA Students.pptxA DAY IN LIFE OF A NEGOTIATOR By Pondicherry University MBA Students.pptx
A DAY IN LIFE OF A NEGOTIATOR By Pondicherry University MBA Students.pptx
 
Obat Aborsi Surabaya 0851\7696\3835 Jual Obat Cytotec Di Surabaya
Obat Aborsi Surabaya 0851\7696\3835 Jual Obat Cytotec Di SurabayaObat Aborsi Surabaya 0851\7696\3835 Jual Obat Cytotec Di Surabaya
Obat Aborsi Surabaya 0851\7696\3835 Jual Obat Cytotec Di Surabaya
 
Pitch Deck Teardown: Goodcarbon's $5.5m Seed deck
Pitch Deck Teardown: Goodcarbon's $5.5m Seed deckPitch Deck Teardown: Goodcarbon's $5.5m Seed deck
Pitch Deck Teardown: Goodcarbon's $5.5m Seed deck
 
What are the differences between an international company, a global company, ...
What are the differences between an international company, a global company, ...What are the differences between an international company, a global company, ...
What are the differences between an international company, a global company, ...
 
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjw
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjwSCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjw
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjw
 
obat aborsi bandung wa 081336238223 jual obat aborsi cytotec asli di bandung9...
obat aborsi bandung wa 081336238223 jual obat aborsi cytotec asli di bandung9...obat aborsi bandung wa 081336238223 jual obat aborsi cytotec asli di bandung9...
obat aborsi bandung wa 081336238223 jual obat aborsi cytotec asli di bandung9...
 
Mastering The Art Of 'Closing The Sale'.
Mastering The Art Of 'Closing The Sale'.Mastering The Art Of 'Closing The Sale'.
Mastering The Art Of 'Closing The Sale'.
 
Navigating Tax Season with Confidence Streamlines CPA Firms
Navigating Tax Season with Confidence Streamlines CPA FirmsNavigating Tax Season with Confidence Streamlines CPA Firms
Navigating Tax Season with Confidence Streamlines CPA Firms
 

Email aliasing in odoo

  • 2. INTRODUCTION • Email aliasing is a default feature in Odoo which allows the user to fetch contents to ERP records directly from incoming emails. The feature is a type of automation. Since we can configure the E-mails to fetch contents directly; it reduces the human effort and simplifies the business process.
  • 3.  To do so we have to follow the following steps. 1. Configure default alias name and alias domain 2. Create a record in model ‘Aliases’ 3. Change ‘message_new’ global function according to your need 4. Configure incoming mail with an Action
  • 4.  Configure default alias name and alias domain  The first step is to configure the default alias name and domain. We can fetch the alias domain from ir.config_parameter. To perform these two tasks, we have to add following fields. alias_prefix = fields.Char('Default Alias Name) alias_domain = fields.Char('Alias Domain', default=lambda self: self.env["ir.config_parameter"].get_param("mail.catchall.domain"))
  • 5.  For eg:- Suppose we need to fetch emails from the mail id ‘leave_request@cybrosys.in’. So here Alias name is ‘leave_request’ and alias domain is ‘cybrosys.in’. We have to set default alias domain in general settings. For that, go to Settings -> General Settings And provide alias domain in the field.
  • 6.  Create a record in model ‘Aliases’  The second step is to create a record in ‘Aliases’ model. For that, we have to add an XML file as follow. <record id="mail_alias_leave" model="mail.alias"> <field name="alias_name">leave</field> <field name="alias_model_id" ref="model_hr_holidays"/> <field name="alias_user_id" ref="base.user_root"/> <field name="alias_contact">employees</field> </record>
  • 7.  Here we have to 'refer' the model in the field ‘alias_model_id’. This is the model which we need to create the record from our incoming mail. Then we can see this record from user interface too.  Go to Settings-> Technical -> Email-> Aliases  Change ‘message_new’ global function according to the need
  • 8.  The next step is to modify the global function ‘message_new’ according to the need. Here we can add parameters which we need to create a record into the dictionary ‘custom_values’. When we update the ‘custom_values’ dictionary, our record will be created according to that information. def message_new(self, msg_dict, custom_values=None): if custom_values is None: custom_values = {} email_address = email_split(msg_dict.get('email_from', False))[0] user = self.env['res.users'].search([ '|', ('email', 'ilike', email_address)) ], limit=1) msg_subject = msg_dict.get('subject', '') msg_body = msg_dict.get('body', '') custom_values.update({ 'name': msg_subject.strip(), 'user_id': user.id, }) return super(HrLeaveAlias, self).message_new(msg_dict, custom_values)
  • 9.  Here we can find the incoming mail id by using ‘email_split’. For that, we need to import this library from odoo.tools. Eg:- from odoo.tools import email_split  Also we can fetch email subject and body from ‘msg’ parameter. Eg:- msg_subject = msg_dict.get('subject', '') msg_body = msg_dict.get('body', '')  In custom values, we can update any values into the corresponding field.
  • 10.  Configure incoming mail with an Action  The final step is to configure the incoming emails with an action.
  • 11.  Form the label ‘Actions to Perform on Incoming Mails’, we can create actions on 1. Record 2. Server Action  If we select a record it will automatically create record while clicking on the button ‘Fetch New’. If we select a server action then it will run while clicking on the button ‘Fetch New’.
  • 12. Refer this link for more: https://www.cybrosys.com/blog/email-aliasing-in-odoo
  • 13. Thank You ! Cybrosys Technologies Pvt. Ltd. Neospace, Kinfra Techno Park, Kakkancherry, Calicut University P.O. Calicut Kerala, India - 673635. Cybrosys Ltd 15, ST Antonys Road, Forest Gate, London England, E79QA. Cybrosys Technologies Pvt. Ltd. 1st Floor, Thapasya Building, Infopark, Kakkanad, Kochi, Kerala, India-682030.