Skip to content

Commit

Permalink
mergeup: mail: actiity: add mail_activity_automation_skip to skip met…
Browse files Browse the repository at this point in the history
…hods
  • Loading branch information
tde-banana-odoo committed Mar 6, 2018
1 parent 844fff6 commit 4db620b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions addons/mail/models/mail_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ def activity_schedule(self, act_type_xmlid='', date_deadline=None, summary='', n
It is useful to avoid having various "env.ref" in the code and allow
to let the mixin handle access rights.
"""
if self.env.context.get('mail_activity_automation_skip'):
return False

if not date_deadline:
date_deadline = fields.Date.today()
if act_type_xmlid:
Expand Down Expand Up @@ -402,6 +405,9 @@ def activity_reschedule(self, act_type_xmlids, user_id=None, date_deadline=None)
""" Reschedule some automated activities. Activities to reschedule can be
limited by the type (xml_id) and by user. Purpose is to be able to change
the deadline, not anything else currently. """
if self.env.context.get('mail_activity_automation_skip'):
return False

Data = self.env['ir.model.data'].sudo()
activity_types_ids = [Data.xmlid_to_res_id(xmlid) for xmlid in act_type_xmlids]
domain = [
Expand All @@ -423,6 +429,9 @@ def activity_reschedule(self, act_type_xmlids, user_id=None, date_deadline=None)
def activity_feedback(self, act_type_xmlids, user_id=None, feedback=None):
""" Set activities as done, limiting to some activity types and
optionally to a given user. """
if self.env.context.get('mail_activity_automation_skip'):
return False

Data = self.env['ir.model.data'].sudo()
activity_types_ids = [Data.xmlid_to_res_id(xmlid) for xmlid in act_type_xmlids]
domain = [
Expand All @@ -442,6 +451,9 @@ def activity_feedback(self, act_type_xmlids, user_id=None, feedback=None):
def activity_unlink(self, act_type_xmlids, user_id=None):
""" Unlink activities, limiting to some activity types and optionally
to a given user. """
if self.env.context.get('mail_activity_automation_skip'):
return False

Data = self.env['ir.model.data'].sudo()
activity_types_ids = [Data.xmlid_to_res_id(xmlid) for xmlid in act_type_xmlids]
domain = [
Expand Down

0 comments on commit 4db620b

Please sign in to comment.