Repository
OCA/server-tools · module folder · Try on Runboat
Module version
2.0.0
Category
Tools
Folder size
0.3 MB
License
AGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/server-tools
Last tracking update
2026-08-07 08:42:57
Authors
Odoo Community Association (OCA), Therp BV
Maintainers
Odoo Community Association (OCA), Therp BV
Committers
Ronald Portier, Weblate, OCA-git-bot, Tom, oca-ci, adrip-s73, AlexGarS73
Odoo dependencies
odoo/odoo:
- web
- bus
Python dependencies
None
System dependencies
None
Required by
None
Description
Adds the possibility to attach emails from a certain IMAP folder to objects,
ie partners. Matching is done via several algorithms, ie email address, email
address's domain or the original Odoo algorithm.

This gives a simple possibility to archive emails in Odoo without a mail
client integration.

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_attach_mail_manually fetchmail.attach.mail.manually fetchmail.attach.mail.manually form New
view_email_server_form fetchmail.server.form fetchmail.server form Inherits mail.view_email_server_form
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (4)

New fields (3)
  • folder_id Many2one → fetchmail.server.folder
    comodel_name='fetchmail.server.folder'
  • mail_ids One2many → fetchmail.attach.mail.manually.mail
    args: 'fetchmail.attach.mail.manually.mail', 'wizard_id', 'Emails'
  • name Char
Public methods (3)
  • attach_mails(self)
  • default_get(self, fields_list)
    @api.model
  • fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False)
    @api.model

New fields (7)
  • body Html
    readonly=True
  • date Datetime
    readonly=True
  • email_from Char
    readonly=True args: 'From'
  • message_uid Char
    readonly=True args: 'Message id'
  • object_id Reference
    args: <expr>
  • subject Char
    readonly=True
  • wizard_id Many2one → fetchmail.attach.mail.manually
    readonly=True args: 'fetchmail.attach.mail.manually'
Public methods (0)

No public methods.

New fields (5)
  • folder_ids One2many → fetchmail.server.folder
    comodel_name='fetchmail.server.folder' context={'active_test': False} inverse_name='server_id' string='Folders'
  • folders_available Text
    compute='_compute_folders_available' string='Available folders'
  • folders_only Boolean
    help='Enable this option to ignore the default IMAP inbox processing and retrieve emails only from the specified folders.' string='Process Only Specified Folders'
  • object_id Many2one
    required=False
  • server_type Selection
    default='imap'
Public methods (2)
  • fetch_mail(self, **kwargs)
  • onchange_server_type(self)
    @api.onchange('server_type', 'is_ssl', 'object_id')

New fields (20)
  • action_id Many2one → ir.actions.server
    comodel_name='ir.actions.server' help='Specify an optional custom server action to trigger for each incoming email. The action will run on the record that was created or updated by this email.' string='Server Action'
  • active Boolean
    default=True
  • archive_path Char
    help='Specify the folder where successfully retrieved emails will be moved after processing. If left empty, emails will remain in the original folder.' string='Archive Folder'
  • delete_matching Boolean
    help='Enable this option to delete emails after they are successfully processed and matched.' string='Delete Matched Emails'
  • domain Char
    help='Define a search filter to narrow down objects for email matching.' string='Matching Domain'
  • fetch_last_day_only Boolean
    help='By default, all emails in the folder are searched. Enable this option to only fetch emails received in the last 24 hours. This helps avoid reprocessing emails if they are not deleted after processing.' string='Fetch Last 24 Hours Only'
  • fetch_unseen_only Boolean
    help='By default, all undeleted emails are retrieved. Enable this option to fetch only unread emails.'
  • flag_nonmatching Boolean
    default=True help='Enable this option to mark emails as important if they do not match any object in Odoo.' string='Flag Non-Matching Emails'
  • mail_field Char
    help="Specify the field in the email used for matching. Typically, this is 'to', 'from' or 'reply_to'." string='Email Field'
  • match_algorithm Selection
    help='Select the algorithm used to determine which object an email matches.' required=True selection=[('odoo_standard', 'Odoo Standard'), ('email_domain', 'Domain of Email Address'), ('email_exact', 'Exact Email Address')] string='Matching Algorithm'
  • match_first Boolean
    help='If there are multiple matches, use the first one. If disabled, multiple matches will be considered as no match.' string='Use First Match'
  • model_field Char
    help="Specify the field in the model that will be used for email matching.\nExamples:\n- 'email' if your model is res.partner\n- 'partner_id.email' if matching sale orders."
  • model_id Many2one → ir.model
    comodel_name='ir.model' help='The model to attach emails to' ondelete='cascade' required=True string='Target Model'
  • model_order Char
    help="Specify the field(s) to order by when matching emails. This is mostly useful in conjunction with 'Use 1st Match'."
  • msg_state Selection
    default='received' help='The state messages fetched from this folder should be assigned in Odoo' selection=[('sent', 'Sent'), ('received', 'Received')] string='Message state'
  • path Char
    help="Specify the IMAP folder path to retrieve emails from. Typically, this would be something like 'INBOX.myfolder'." required=True string='Fetch from Folder'
  • seen Selection
    default='on_fetch' required=True selection=[('on_fetch', 'Immediately on Fetch'), ('all', 'After Processing'), ('matching', 'When matching'), ('none', 'Never')] string='Mark email as seen'
  • sequence Integer
  • server_id Many2one → fetchmail.server
    args: 'fetchmail.server'
  • state Selection
    copy=False default='draft' readonly=True required=True string='Status' args: [('draft', 'Not Confirmed'), ('done', 'Confirmed')]
Public methods (13)
  • apply_matching(self, connection, message_uid)
    Return id of object matched (which will be the thread_id).
  • attach_mail(self, match_object, message_dict)
    Attach mail to match_object.
  • button_attach_mail_manually(self)
  • button_confirm_folder(self)
  • check_imap_archive_folder(self, connection)
    If archive folder specified, check existance and create when needed.
  • fetch_mail(self)
    Retrieve all mails for IMAP folders. We will use a separate connection for each folder.
  • fetch_msg(self, connection, message_uid)
    Select a single message from a folder.
  • get_criteria(self)
  • get_message_uids(self, connection, criteria)
    Return imap ids of messages to process
  • retrieve_imap_folder(self, connection)
    Retrieve all mails for one IMAP folder.
  • run_server_action(self, matched_object_ids)
  • set_draft(self)
  • update_msg(self, connection, message_uid, matched=True, flagged=False)
    Update msg in imap folder depending on match and settings.

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…