[FIX] base_automation: warn email are not compatible with unlink
Create a automated action on deletion that send an email, delete a related record. The email is not sent. Email are linked to their chatter message, when the later is deleted the former is deleted in cascade too. This is a known limitation of the mail model. closes odoo/odoo#62616 Task: 2151519 X-original-commit: f8904eb19d82d1d255c1ef091d1e47e0e016a62f Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com> Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
@@ -107,6 +107,16 @@ class BaseAutomation(models.Model):
|
||||
}
|
||||
}}
|
||||
|
||||
MAIL_STATES = ('email', 'followers', 'next_activity')
|
||||
if self.trigger == 'on_unlink' and self.state in MAIL_STATES:
|
||||
return {'warning': {
|
||||
'title': _("Warning"),
|
||||
'message': _(
|
||||
"You cannot send an email, add followers or create an activity "
|
||||
"for a deleted record. It simply does not work."
|
||||
),
|
||||
}}
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
|
||||
Reference in New Issue
Block a user