The purpose of this commit is to handle code execution only in server action and delegate schedule management to ir_cron model. ir.cron model now inherits from ir.actions.server. Fields model, function and args are removed as well as the logic to handle them. There is no more code manipulation and evaluation in ir_cron, only a call to the run method of ir.actions.server. Cron form view use server action form view as primary view. This way automated actions use the same base form as server actions with cron details added. Thanks to @fpodoo for the original idea and preliminary work. Thanks to @jpr-odoo for first developments. Thanks to @jem-odoo for reviewing.
160 lines
6.6 KiB
XML
160 lines
6.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<data noupdate="1">
|
|
<record forcecreate="True" id="ir_cron_mail_scheduler_action" model="ir.cron">
|
|
<field name="name">Mail: Email Queue Manager</field>
|
|
<field name="model_id" ref="model_mail_mail"/>
|
|
<field name="state">code</field>
|
|
<field name="code">model.process_email_queue()</field>
|
|
<field name="user_id" ref="base.user_root"/>
|
|
<field name="interval_number">1</field>
|
|
<field name="interval_type">hours</field>
|
|
<field name="numbercall">-1</field>
|
|
<field eval="False" name="doall"/>
|
|
</record>
|
|
|
|
<record id="ir_cron_module_update_notification" model="ir.cron">
|
|
<field name="name">Publisher: Update Notification</field>
|
|
<field name="model_id" ref="model_publisher_warranty_contract"/>
|
|
<field name="state">code</field>
|
|
<field name="code">model.update_notification(None)</field>
|
|
<field name="user_id" ref="base.user_root" />
|
|
<field name="interval_number">1</field>
|
|
<field name="interval_type">weeks</field>
|
|
<field name="numbercall">-1</field>
|
|
<field name="nextcall" eval="(DateTime.now() + timedelta(days=7)).strftime('%Y-%m-%d %H:%M:%S')" />
|
|
<field eval="False" name="doall" />
|
|
<field name="priority">1000</field>
|
|
</record>
|
|
|
|
<!-- Admin should not receivve emails at creation -->
|
|
<record id="base.partner_root" model="res.partner">
|
|
<field name="notify_email">none</field>
|
|
</record>
|
|
|
|
<!-- Catchall Email Alias -->
|
|
<record id="icp_mail_catchall_alias" model="ir.config_parameter">
|
|
<field name="key">mail.catchall.alias</field>
|
|
<field name="value">catchall</field>
|
|
</record>
|
|
|
|
<!-- Bounce Email Alias -->
|
|
<record id="icp_mail_bounce_alias" model="ir.config_parameter">
|
|
<field name="key">mail.bounce.alias</field>
|
|
<field name="value">bounce</field>
|
|
</record>
|
|
|
|
<!-- Discussion subtype for messaging / Chatter -->
|
|
<record id="mt_comment" model="mail.message.subtype">
|
|
<field name="name">Discussions</field>
|
|
<field name="sequence" eval="0"/>
|
|
</record>
|
|
<record id="mt_note" model="mail.message.subtype">
|
|
<field name="name">Note</field>
|
|
<field name="default" eval="False"/>
|
|
<field name="internal" eval="True"/>
|
|
<field name="sequence" eval="100"/>
|
|
</record>
|
|
<record id="mt_activities" model="mail.message.subtype">
|
|
<field name="name">Activities</field>
|
|
<field name="default" eval="True"/>
|
|
<field name="internal" eval="True"/>
|
|
<field name="sequence" eval="90"/>
|
|
</record>
|
|
|
|
</data>
|
|
<data>
|
|
<!--Default Notification Email template -->
|
|
<record id="mail_template_data_notification_email_default" model="mail.template">
|
|
<field name="name">Notification Email</field>
|
|
<field name="subject">${object.subject or (object.record_name and 'Re: %s' % object.record_name) or (object.parent_id and object.parent_id.subject and 'Re: %s' % object.parent_id.subject) or (object.parent_id and object.parent_id.record_name and 'Re: %s' % object.parent_id.record_name)}</field>
|
|
<field name="model_id" ref="mail.model_mail_message"/>
|
|
<field name="auto_delete" eval="True"/>
|
|
<field name="body_html"><![CDATA[
|
|
<div>
|
|
% if ctx.get('has_button_access'):
|
|
<div itemscope itemtype="http://schema.org/EmailMessage">
|
|
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction">
|
|
<link itemprop="target" href="${ctx['button_access']['url']}"/>
|
|
<link itemprop="url" href="${ctx['button_access']['url']}"/>
|
|
<meta itemprop="name" content="View ${ctx['model_name']}"/>
|
|
</div>
|
|
</div>
|
|
% endif
|
|
% if not ctx['is_discussion'] or not len(ctx['actions']) == 0 or ctx.get('has_button_access'):
|
|
<div summary="o_mail_notification" style="padding: 0px; width:600px;">
|
|
<table cellspacing="0" cellpadding="0" border="0" style="width: 600px; margin-top: 5px;">
|
|
<tbody><tr>
|
|
<td valign="center">
|
|
% if ctx.get('has_button_access'):
|
|
<a href="${ctx['button_access']['url']}" style="padding: 8px 12px; font-size: 12px; color: #FFFFFF; text-decoration: none !important; font-weight: 400; background-color: #875A7B; border: 0px solid #875A7B; border-radius:3px">${ctx['button_access']['title']}</a>
|
|
% endif
|
|
|
|
% if ctx.get('has_button_follow'):
|
|
% if ctx.get('has_button_access'):
|
|
|
|
|
% endif
|
|
<a href="${ctx['button_follow']['url']}" style="color: #875A7B; text-decoration: none !important;">${ctx['button_follow']['title']}</a>
|
|
% elif ctx.get('has_button_unfollow'):
|
|
% if ctx.get('has_button_access'):
|
|
|
|
|
% endif
|
|
<a href="${ctx['button_unfollow']['url']}" style="color: #875A7B; text-decoration: none !important;">${ctx['button_unfollow']['title']}</a>
|
|
% endif
|
|
|
|
% if ctx.get('actions'):
|
|
% for action in ctx['actions']:
|
|
|
|
|
<a href="${action['url']}" style="color: #875A7B; text-decoration:none !important;">${action['title']}</a>
|
|
% endfor
|
|
% endif
|
|
</td>
|
|
<td valign="center" align="right">
|
|
<img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" style="text-align:center;">
|
|
<hr width="100%"
|
|
style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin:10px 0;">
|
|
% if ctx.get('subtype') and ctx.get('subtype').internal:
|
|
<span style="background-color: #f2dede; padding: 5px;">
|
|
<strong>Internal note</strong>: replies are not sent to followers.
|
|
</span>
|
|
% endif
|
|
</td>
|
|
</tr>
|
|
</tbody></table>
|
|
</div>
|
|
% endif
|
|
${object.body | safe}
|
|
% if ctx.get('tracking'):
|
|
<ul>
|
|
% for tracking in ctx['tracking']
|
|
<li>${tracking[0]} : ${tracking[1]} -> ${tracking[2]}</li>
|
|
% endfor
|
|
</ul>
|
|
% endif
|
|
|
|
% if ctx.get('signature'):
|
|
${ctx['signature'] | safe}
|
|
% endif
|
|
<br/>
|
|
<p style="color: #555555;">
|
|
Sent by
|
|
% if ctx.get('website_url'):
|
|
<a href="${ctx['website_url']}" style="text-decoration:none; color: #875A7B;">
|
|
% endif
|
|
${ctx.get('company_name')}
|
|
% if ctx.get('website_url'):
|
|
</a>
|
|
% endif
|
|
using
|
|
<a href="https://www.odoo.com" style="text-decoration:none; color: #875A7B;">Odoo</a>.
|
|
</p>
|
|
</div>]]></field>
|
|
</record>
|
|
|
|
</data>
|
|
</odoo>
|