[IMP] Multiple emails can be send, retry and cancel from the tree view
This commit is contained in:
parent
d3f4a54f93
commit
3590c60b50
|
@ -36,6 +36,7 @@
|
||||||
'views/ir_actions_views.xml',
|
'views/ir_actions_views.xml',
|
||||||
'views/ir_model_views.xml',
|
'views/ir_model_views.xml',
|
||||||
'views/res_partner_views.xml',
|
'views/res_partner_views.xml',
|
||||||
|
'wizard/mass_mail.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
'data/mail_demo.xml',
|
'data/mail_demo.xml',
|
||||||
|
|
|
@ -5,3 +5,5 @@ from . import invite
|
||||||
from . import mail_compose_message
|
from . import mail_compose_message
|
||||||
from . import email_template_preview
|
from . import email_template_preview
|
||||||
from . import base_module_uninstall
|
from . import base_module_uninstall
|
||||||
|
from . import mass_mail
|
||||||
|
|
||||||
|
|
23
addons/mail/wizard/mass_mail.py
Normal file
23
addons/mail/wizard/mass_mail.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
|
from flectra import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class MassMail(models.TransientModel):
|
||||||
|
_name = 'mass.mail'
|
||||||
|
_description = 'Mass Mail Options'
|
||||||
|
|
||||||
|
message = fields.Char('Message')
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def mass_emails(self):
|
||||||
|
send_method = self.env.context['mail']
|
||||||
|
active_ids = self.env.context['active_ids']
|
||||||
|
lines = self.env['mail.mail'].search([( 'id', 'in', active_ids)])
|
||||||
|
if send_method == 'mark_outgoing':
|
||||||
|
lines.mark_outgoing()
|
||||||
|
elif send_method == 'send':
|
||||||
|
lines.send()
|
||||||
|
elif send_method == 'cancel':
|
||||||
|
lines.cancel()
|
71
addons/mail/wizard/mass_mail.xml
Normal file
71
addons/mail/wizard/mass_mail.xml
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<flectra>
|
||||||
|
<data>
|
||||||
|
<record id="view_mass_retry_mail_form" model="ir.ui.view">
|
||||||
|
<field name="name">mass.retry.mail.form</field>
|
||||||
|
<field name="model">mass.mail</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Retry">
|
||||||
|
<h2>Are you sure?</h2>
|
||||||
|
<footer>
|
||||||
|
<span groups="base.group_user">
|
||||||
|
<button string="Yes" type="object"
|
||||||
|
name="mass_emails" class="oe_highlight"/>
|
||||||
|
or
|
||||||
|
<button special="cancel" string="No" type="object" />
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<act_window id="action_mass_retry_mail_view" multi="True"
|
||||||
|
context="{'mail': 'mark_outgoing'}"
|
||||||
|
name="Retry" res_model="mass.mail" src_model="mail.mail"
|
||||||
|
view_mode="form" target="new" view_type="form" />
|
||||||
|
|
||||||
|
<record id="view_mass_resend_mail_form" model="ir.ui.view">
|
||||||
|
<field name="name">mass.resend.mail.form</field>
|
||||||
|
<field name="model">mass.mail</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Resend">
|
||||||
|
<h2>Are you sure?</h2>
|
||||||
|
<footer>
|
||||||
|
<span groups="base.group_user">
|
||||||
|
<button string="Yes" type="object"
|
||||||
|
name="mass_emails" class="oe_highlight"/>
|
||||||
|
or
|
||||||
|
<button special="cancel" string="No" type="object" />
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<act_window id="action_mass_resend_mail_view" multi="True"
|
||||||
|
context="{'mail': 'send'}"
|
||||||
|
name="Resend" res_model="mass.mail" src_model="mail.mail"
|
||||||
|
view_mode="form" target="new" view_type="form" />
|
||||||
|
|
||||||
|
<record id="view_mass_cancel_mail_form" model="ir.ui.view">
|
||||||
|
<field name="name">mass.cancel.mail.form</field>
|
||||||
|
<field name="model">mass.mail</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Cancel">
|
||||||
|
<h2>Are you sure?</h2>
|
||||||
|
<footer>
|
||||||
|
<span groups="base.group_user">
|
||||||
|
<button string="Yes" type="object"
|
||||||
|
name="mass_emails" class="oe_highlight"/>
|
||||||
|
or
|
||||||
|
<button special="cancel" string="No" type="object" />
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<act_window id="action_mass_cancel_mail_view" multi="True"
|
||||||
|
context="{'mail': 'cancel'}"
|
||||||
|
name="Cancel" res_model="mass.mail" src_model="mail.mail"
|
||||||
|
view_mode="form" target="new" view_type="form" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</flectra>
|
Loading…
Reference in New Issue
Block a user