summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorOlivier Dony <odo@odoo.com>2018-06-23 03:06:16 +0200
committerOlivier Dony <odo@odoo.com>2018-06-23 03:12:04 +0200
commitc77d3e55318dda66517c4da708de252eac6c3a5b (patch)
tree53aff4aa0c1223f5f4d417b80a6ecc958d0f37ce /addons
parenta17cd938640a0597f6a9781bb6b8b4b6abafbded (diff)
[FIX] mail: line endings: DOS->UNIX
Diffstat (limited to 'addons')
-rw-r--r--addons/mail/wizard/mail_resend_message.py168
-rw-r--r--addons/mail/wizard/mail_resend_message_views.xml84
2 files changed, 126 insertions, 126 deletions
diff --git a/addons/mail/wizard/mail_resend_message.py b/addons/mail/wizard/mail_resend_message.py
index b4480220e4f..4e83e32aaab 100644
--- a/addons/mail/wizard/mail_resend_message.py
+++ b/addons/mail/wizard/mail_resend_message.py
@@ -1,84 +1,84 @@
-# -*- coding: utf-8 -*-
-# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
-from odoo import _, api, fields, models
-from ast import literal_eval
-from odoo.exceptions import UserError
-
-class MailResendMessage(models.TransientModel):
- _name = 'mail.resend.message'
- _description = 'Email resend wizard'
-
- mail_message_id = fields.Many2one('mail.message', 'Message', readonly=True)
- partner_ids = fields.One2many('mail.resend.partner', 'resend_wizard_id', string='Recipients')
- notification_ids = fields.Many2many('mail.notification', string='Notifications', readonly=True)
- has_cancel = fields.Boolean(compute='_compute_has_cancel')
- partner_readonly = fields.Boolean(compute='_compute_partner_readonly')
-
- @api.depends("partner_ids")
- def _compute_has_cancel(self):
- self.has_cancel = self.partner_ids.filtered(lambda p: not p.resend)
-
- def _compute_partner_readonly(self):
- self.partner_readonly = not self.env['res.partner'].check_access_rights('write', raise_exception=False)
-
- @api.model
- def default_get(self, fields):
- rec = super(MailResendMessage, self).default_get(fields)
- message_id = self._context.get('mail_message_to_resend')
- if message_id:
- mail_message_id = self.env['mail.message'].browse(message_id)
- notification_ids = mail_message_id.notification_ids.filtered(lambda notif: notif.email_status in ('exception', 'bounce'))
- partner_readonly = not self.env['res.partner'].check_access_rights('write', raise_exception=False)
- partner_ids = [(0, 0,
- {
- "partner_id": notif.res_partner_id.id,
- "name": notif.res_partner_id.name,
- "email": notif.res_partner_id.email,
- "resend": True,
- "message": notif.format_failure_reason(),
- }
- ) for notif in notification_ids]
- rec['partner_readonly'] = partner_readonly
- rec['notification_ids'] = [(6, 0, notification_ids.ids)]
- rec['mail_message_id'] = mail_message_id.id
- rec['partner_ids'] = partner_ids
- else:
- raise UserError('No message_id found in context')
- return rec
-
- @api.multi
- def resend_mail_action(self):
- """ Process the wizard content and proceed with sending the related
- email(s), rendering any template patterns on the fly if needed. """
- for wizard in self:
- "If a partner disappeared from partner list, we cancel the notification"
- to_cancel = wizard.partner_ids.filtered(lambda p: not p.resend).mapped("partner_id")
- to_send = wizard.partner_ids.filtered(lambda p: p.resend).mapped("partner_id")
- notif_to_cancel = wizard.notification_ids.filtered(lambda notif: notif.res_partner_id in to_cancel and notif.email_status in ('exception', 'bounce'))
- notif_to_cancel.sudo().write({'email_status': 'canceled'})
- to_send.sudo()._notify(self.mail_message_id, self.mail_message_id.layout, force_send=True, send_after_commit=False, values=literal_eval(self.mail_message_id.layout_values))
- self.mail_message_id._notify_failure_update()
- return {'type': 'ir.actions.act_window_close'}
-
- @api.multi
- def cancel_mail_action(self):
- for wizard in self:
- for notif in wizard.notification_ids:
- notif.filtered(lambda notif: notif.email_status in ('exception', 'bounce')).sudo().write({'email_status': 'canceled'})
- wizard.mail_message_id._notify_failure_update()
- return {'type': 'ir.actions.act_window_close'}
-
-
-
-class PartnerResend(models.TransientModel):
- _name = 'mail.resend.partner'
- _description = 'Partner with additionnal information for mail resend'
-
- partner_id = fields.Many2one('res.partner', string='Partner', required=True, ondelete='cascade')
- name = fields.Char(related="partner_id.name")
- email = fields.Char(related="partner_id.email")
- resend = fields.Boolean(string="Send Again", default=True)
- resend_wizard_id = fields.Many2one('mail.resend.message', string="Resend wizard")
- message = fields.Char(string="Help message")
-
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import _, api, fields, models
+from ast import literal_eval
+from odoo.exceptions import UserError
+
+class MailResendMessage(models.TransientModel):
+ _name = 'mail.resend.message'
+ _description = 'Email resend wizard'
+
+ mail_message_id = fields.Many2one('mail.message', 'Message', readonly=True)
+ partner_ids = fields.One2many('mail.resend.partner', 'resend_wizard_id', string='Recipients')
+ notification_ids = fields.Many2many('mail.notification', string='Notifications', readonly=True)
+ has_cancel = fields.Boolean(compute='_compute_has_cancel')
+ partner_readonly = fields.Boolean(compute='_compute_partner_readonly')
+
+ @api.depends("partner_ids")
+ def _compute_has_cancel(self):
+ self.has_cancel = self.partner_ids.filtered(lambda p: not p.resend)
+
+ def _compute_partner_readonly(self):
+ self.partner_readonly = not self.env['res.partner'].check_access_rights('write', raise_exception=False)
+
+ @api.model
+ def default_get(self, fields):
+ rec = super(MailResendMessage, self).default_get(fields)
+ message_id = self._context.get('mail_message_to_resend')
+ if message_id:
+ mail_message_id = self.env['mail.message'].browse(message_id)
+ notification_ids = mail_message_id.notification_ids.filtered(lambda notif: notif.email_status in ('exception', 'bounce'))
+ partner_readonly = not self.env['res.partner'].check_access_rights('write', raise_exception=False)
+ partner_ids = [(0, 0,
+ {
+ "partner_id": notif.res_partner_id.id,
+ "name": notif.res_partner_id.name,
+ "email": notif.res_partner_id.email,
+ "resend": True,
+ "message": notif.format_failure_reason(),
+ }
+ ) for notif in notification_ids]
+ rec['partner_readonly'] = partner_readonly
+ rec['notification_ids'] = [(6, 0, notification_ids.ids)]
+ rec['mail_message_id'] = mail_message_id.id
+ rec['partner_ids'] = partner_ids
+ else:
+ raise UserError('No message_id found in context')
+ return rec
+
+ @api.multi
+ def resend_mail_action(self):
+ """ Process the wizard content and proceed with sending the related
+ email(s), rendering any template patterns on the fly if needed. """
+ for wizard in self:
+ "If a partner disappeared from partner list, we cancel the notification"
+ to_cancel = wizard.partner_ids.filtered(lambda p: not p.resend).mapped("partner_id")
+ to_send = wizard.partner_ids.filtered(lambda p: p.resend).mapped("partner_id")
+ notif_to_cancel = wizard.notification_ids.filtered(lambda notif: notif.res_partner_id in to_cancel and notif.email_status in ('exception', 'bounce'))
+ notif_to_cancel.sudo().write({'email_status': 'canceled'})
+ to_send.sudo()._notify(self.mail_message_id, self.mail_message_id.layout, force_send=True, send_after_commit=False, values=literal_eval(self.mail_message_id.layout_values))
+ self.mail_message_id._notify_failure_update()
+ return {'type': 'ir.actions.act_window_close'}
+
+ @api.multi
+ def cancel_mail_action(self):
+ for wizard in self:
+ for notif in wizard.notification_ids:
+ notif.filtered(lambda notif: notif.email_status in ('exception', 'bounce')).sudo().write({'email_status': 'canceled'})
+ wizard.mail_message_id._notify_failure_update()
+ return {'type': 'ir.actions.act_window_close'}
+
+
+
+class PartnerResend(models.TransientModel):
+ _name = 'mail.resend.partner'
+ _description = 'Partner with additionnal information for mail resend'
+
+ partner_id = fields.Many2one('res.partner', string='Partner', required=True, ondelete='cascade')
+ name = fields.Char(related="partner_id.name")
+ email = fields.Char(related="partner_id.email")
+ resend = fields.Boolean(string="Send Again", default=True)
+ resend_wizard_id = fields.Many2one('mail.resend.message', string="Resend wizard")
+ message = fields.Char(string="Help message")
+
diff --git a/addons/mail/wizard/mail_resend_message_views.xml b/addons/mail/wizard/mail_resend_message_views.xml
index 85af6dc4b09..c20fe9e9358 100644
--- a/addons/mail/wizard/mail_resend_message_views.xml
+++ b/addons/mail/wizard/mail_resend_message_views.xml
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="utf-8"?>
-<odoo>
- <data>
- <record id="mail_resend_message_view_form" model="ir.ui.view">
- <field name="name">mail.resend.message.form</field>
- <field name="model">mail.resend.message</field>
- <field name="groups_id" eval="[(4,ref('base.group_user'))]"/>
- <field name="arch" type="xml">
- <form string="Edit Partners">
- <field name="mail_message_id" invisible="1"/>
- <field name="notification_ids" invisible="1"/>
- <field name="has_cancel" invisible="1"/>
- <field name="partner_readonly" invisible="1"/>
- <p>Please, select the action to do on each mail and correct the email address if needed. The modified address will be saved on the corresponding contact.</p>
- <field name="partner_ids">
- <tree string="Recipient" editable="top" create="0" delete="0">
- <field name="name" readonly="1"/>
- <field name="email" attrs="{'readonly': [('parent.partner_readonly', '=', True)]}"/>
- <field name="message" readonly="1"/>
- <field name="resend" widget="boolean_toggle"/>
- </tree>
- </field>
- <p attrs="{'invisible':[('has_cancel', '==', False)]}"> <span class="fa fa-info-circle"/> Caution: It won't be possible to send this mail again to the recipients you did not select.</p>
- <footer>
- <button string="Resend to selected" name="resend_mail_action" type="object" class="btn-primary o_mail_send"/>
- <button string="Ignore all failure" name="cancel_mail_action" type="object" class="btn-default" />
- <button string="Cancel" class="btn-default" special="cancel" />
- </footer>
- </form>
- </field>
- </record>
- <record id="mail_resend_message_action" model="ir.actions.act_window">
- <field name="name">Resend mail</field>
- <field name="res_model">mail.resend.message</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">form</field>
- <field name="target">new</field>
- </record>
-
- </data>
-</odoo>
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <data>
+ <record id="mail_resend_message_view_form" model="ir.ui.view">
+ <field name="name">mail.resend.message.form</field>
+ <field name="model">mail.resend.message</field>
+ <field name="groups_id" eval="[(4,ref('base.group_user'))]"/>
+ <field name="arch" type="xml">
+ <form string="Edit Partners">
+ <field name="mail_message_id" invisible="1"/>
+ <field name="notification_ids" invisible="1"/>
+ <field name="has_cancel" invisible="1"/>
+ <field name="partner_readonly" invisible="1"/>
+ <p>Please, select the action to do on each mail and correct the email address if needed. The modified address will be saved on the corresponding contact.</p>
+ <field name="partner_ids">
+ <tree string="Recipient" editable="top" create="0" delete="0">
+ <field name="name" readonly="1"/>
+ <field name="email" attrs="{'readonly': [('parent.partner_readonly', '=', True)]}"/>
+ <field name="message" readonly="1"/>
+ <field name="resend" widget="boolean_toggle"/>
+ </tree>
+ </field>
+ <p attrs="{'invisible':[('has_cancel', '==', False)]}"> <span class="fa fa-info-circle"/> Caution: It won't be possible to send this mail again to the recipients you did not select.</p>
+ <footer>
+ <button string="Resend to selected" name="resend_mail_action" type="object" class="btn-primary o_mail_send"/>
+ <button string="Ignore all failure" name="cancel_mail_action" type="object" class="btn-default" />
+ <button string="Cancel" class="btn-default" special="cancel" />
+ </footer>
+ </form>
+ </field>
+ </record>
+ <record id="mail_resend_message_action" model="ir.actions.act_window">
+ <field name="name">Resend mail</field>
+ <field name="res_model">mail.resend.message</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+
+ </data>
+</odoo>