summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJulien Castiaux <juc@odoo.com>2020-02-07 10:12:42 +0000
committerJulien Castiaux <juc@odoo.com>2020-11-30 11:57:24 +0000
commitf8904eb19d82d1d255c1ef091d1e47e0e016a62f (patch)
tree2b3578cb994259b90e50429501f9d8295181ca1c /addons
parenta6444faa7bf45b14c4ad63a033814ab0d20ba1da (diff)
[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#62606 Task: 2151519 X-original-commit: bd234e5da3ba0e5091bd25dcdddf411968df6348 Signed-off-by: Raphael Collet (rco) <rco@openerp.com> Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/base_automation/models/base_automation.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/base_automation/models/base_automation.py b/addons/base_automation/models/base_automation.py
index 2fd82b39388..e21df36ee9a 100644
--- a/addons/base_automation/models/base_automation.py
+++ b/addons/base_automation/models/base_automation.py
@@ -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: