summaryrefslogtreecommitdiff
path: root/addons/test_mail/models
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2017-11-17 12:59:00 +0100
committerThibault Delavallée <tde@odoo.com>2018-03-27 15:00:46 +0200
commit60b81e00b27edd95d31d668687561e0b2dd7c714 (patch)
treec9153842fd664bb343587d8e3fb29d2ac2549f8a /addons/test_mail/models
parent093dd9b5122bc8a627d758a86839b42d3fdc0bc4 (diff)
[IMP] mail: add tool methods to manage activities directly from the mixin
This commit adds tools methods related to activities in the mail.activity mixin. It gives to models inheriting from the activity mixin an easy-to-use API to schedule, unlink or mark activities as done. Purpose of those methods is to avoid having people manually managing activities in the code to hide the technical details of the activities model, notably access rights or activity types. A field is added on activity model to indicate they have been generated automatically. This way when rescheduling or unlinking based on some specific activity types we do not change user-created activities. Those methods include scheduling activities, changing their dates, marking them as done or unlinking them. Future commits will use those methods in various addons to automatically generate activities based on workflow we want to implement. This commit also adds tests for the newly added code. Future commits should probably have a look at activity security and add some tests cases to check it is correctly taken into account. It is considered a bit out of scope for this task. Thanks to @jem-odoo for its in-depth review of this commit. Well thanks for other commits also.
Diffstat (limited to 'addons/test_mail/models')
-rw-r--r--addons/test_mail/models/test_mail_models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/test_mail/models/test_mail_models.py b/addons/test_mail/models/test_mail_models.py
index 4c1fd408ddf..06d84986fe8 100644
--- a/addons/test_mail/models/test_mail_models.py
+++ b/addons/test_mail/models/test_mail_models.py
@@ -38,6 +38,15 @@ class MailTestActivity(models.Model):
name = fields.Char()
email_from = fields.Char()
+ def action_start(self, action_summary):
+ self.activity_schedule(
+ 'test_mail.mail_act_test_todo',
+ summary=action_summary
+ )
+
+ def action_close(self, action_feedback):
+ self.activity_feedback(['test_mail.mail_act_test_todo'], feedback=action_feedback)
+
class MailTestFull(models.Model):
""" This model can be used in tests when complex chatter features are