Incoming email servers have an action_id field holding a server action to run on newly created records. It comes from old implementation of mail gateways in Odoo. Since then mail gateway has evolved. Incoming mail servers are not linked to a unique model anymore. With aliases and automatic thread creation mails can create records in various models. As the server action is bound to a given model it causes issues. Either we have to give back the result of the mail gateway processing to ensure models match. Either we have to limit action_id to records created using the "default model behavior" of incoming mail servers. We choose to remove this field. Same result can be achieved with an automated action running on create trigger. If exactly the same behavior is intended the following rules should be applied * add automated action with model linked to the one you want to update depending on alias configuration and work flow; * set trigger to create; * set action as python; * if it is necessary to be linked to the mail gateway, check in record message_ids that there is a message with message_type being 'email' meaning it has received an incoming email; Using that heuristic migrating existing fetchmail action to server actions should be quite straightforward and will give more flexibility. This commit is linked to task ID 58641. Closes #23621 .
105 lines
5.2 KiB
XML
105 lines
5.2 KiB
XML
<?xml version="1.0"?>
|
|
<odoo>
|
|
|
|
<record id="view_email_server_tree" model="ir.ui.view">
|
|
<field name="name">fetchmail.server.list</field>
|
|
<field name="model">fetchmail.server</field>
|
|
<field name="arch" type="xml">
|
|
<tree decoration-info="state == 'draft'" string="POP/IMAP Servers">
|
|
<field name="name"/>
|
|
<field name="type"/>
|
|
<field name="is_ssl"/>
|
|
<field name="object_id"/>
|
|
<field name="date"/>
|
|
<field name="message_ids" string="Email Count"/>
|
|
<field name="state"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="view_email_server_form" model="ir.ui.view">
|
|
<field name="name">fetchmail.server.form</field>
|
|
<field name="model">fetchmail.server</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Incoming Mail Server">
|
|
<header attrs="{'invisible' : [('type', '=', 'local')]}">
|
|
<button string="Test & Confirm" type="object" name="button_confirm_login" states="draft"/>
|
|
<button string="Fetch Now" type="object" name="fetch_mail" states="done"/>
|
|
<button string="Reset Confirmation" type="object" name="set_draft" states="done"/>
|
|
<field name="state" widget="statusbar"/>
|
|
</header>
|
|
<sheet>
|
|
<group col="4">
|
|
<field name="name"/>
|
|
<field name="type"/>
|
|
<field name="date"/>
|
|
</group>
|
|
<notebook>
|
|
<page string="Server & Login">
|
|
<group>
|
|
<group attrs="{'invisible' : [('type', '=', 'local')]}" string="Server Information">
|
|
<field name="server" colspan="2" attrs="{'required' : [('type', '!=', 'local')]}" />
|
|
<field name="port" required="1" attrs="{'required' : [('type', '!=', 'local')]}" />
|
|
<field name="is_ssl"/>
|
|
</group>
|
|
<group attrs="{'invisible' : [('type', '=', 'local')]}" string="Login Information">
|
|
<field name="user" attrs="{'required' : [('type', '!=', 'local')]}"/>
|
|
<field name="password" password="True" attrs="{'required' : [('type', '!=', 'local')]}"/>
|
|
</group>
|
|
<group string="Actions to Perform on Incoming Mails">
|
|
<field name="object_id"/>
|
|
</group>
|
|
<group attrs="{'invisible' : [('type', '!=', 'local')]}" string="Configuration">
|
|
<field name="configuration" colspan="4"/>
|
|
<field name="script" colspan="4" widget="url"/>
|
|
</group>
|
|
</group>
|
|
</page>
|
|
<page string="Advanced" groups="base.group_no_one">
|
|
<group string="Advanced Options" col="4">
|
|
<field name="priority"/>
|
|
<field name="attach"/>
|
|
<field name="original"/>
|
|
<field name="active"/>
|
|
</group>
|
|
</page>
|
|
</notebook>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="view_email_server_search" model="ir.ui.view">
|
|
<field name="name">fetchmail.server.search</field>
|
|
<field name="model">fetchmail.server</field>
|
|
<field name="arch" type="xml">
|
|
<search string="Search Incoming Mail Servers">
|
|
<field name="name" string="Incoming Mail Server"/>
|
|
<filter string="IMAP" name="imap" domain="[('type','=','imap')]" help="Server type IMAP."/>
|
|
<filter string="POP" name="pop" domain="[('type','=','pop')]" help="Server type POP."/>
|
|
<separator/>
|
|
<filter string="SSL" name="ssl" domain="[('is_ssl','=',True)]" help="If SSL required."/>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="action_email_server_tree" model="ir.actions.act_window">
|
|
<field name="name">Incoming Mail Servers</field>
|
|
<field name="res_model">fetchmail.server</field>
|
|
<field name="view_type">form</field>
|
|
<field name="view_mode">tree,form</field>
|
|
<field name="view_id" ref="view_email_server_tree"/>
|
|
<field name="search_view_id" ref="view_email_server_search"/>
|
|
</record>
|
|
|
|
<menuitem
|
|
parent="base.menu_email"
|
|
id="menu_action_fetchmail_server_tree"
|
|
action="action_email_server_tree"
|
|
name="Incoming Mail Servers"
|
|
sequence="14"
|
|
groups="base.group_no_one"
|
|
/>
|
|
|
|
</odoo>
|