|
@ -156,13 +156,19 @@ class TierValidation(models.AbstractModel): |
|
|
}) |
|
|
}) |
|
|
for review in user_reviews: |
|
|
for review in user_reviews: |
|
|
rec = self.env[review.model].browse(review.res_id) |
|
|
rec = self.env[review.model].browse(review.res_id) |
|
|
if hasattr(rec, 'message_post'): |
|
|
|
|
|
|
|
|
rec._notify_accepted_reviews() |
|
|
|
|
|
|
|
|
|
|
|
def _notify_accepted_reviews(self): |
|
|
|
|
|
if hasattr(self, 'message_post'): |
|
|
# Notify state change |
|
|
# Notify state change |
|
|
getattr(rec, 'message_post')( |
|
|
|
|
|
|
|
|
getattr(self, 'message_post')( |
|
|
subtype='mt_comment', |
|
|
subtype='mt_comment', |
|
|
body=_('A review was accepted') |
|
|
|
|
|
|
|
|
body=self._notify_accepted_reviews_body() |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def _notify_accepted_reviews_body(self): |
|
|
|
|
|
return _('A review was accepted') |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def validate_tier(self): |
|
|
def validate_tier(self): |
|
|
for rec in self: |
|
|
for rec in self: |
|
@ -180,13 +186,17 @@ class TierValidation(models.AbstractModel): |
|
|
'done_by': self.env.user.id, |
|
|
'done_by': self.env.user.id, |
|
|
'reviewed_date': fields.Datetime.now(), |
|
|
'reviewed_date': fields.Datetime.now(), |
|
|
}) |
|
|
}) |
|
|
if hasattr(rec, 'message_post'): |
|
|
|
|
|
|
|
|
rec._notify_rejected_review() |
|
|
|
|
|
|
|
|
|
|
|
def _notify_rejected_review_body(self): |
|
|
|
|
|
return _('A review was rejected by %s.') % (self.env.user.name) |
|
|
|
|
|
|
|
|
|
|
|
def _notify_rejected_review(self): |
|
|
|
|
|
if hasattr(self, 'message_post'): |
|
|
# Notify state change |
|
|
# Notify state change |
|
|
getattr(rec, 'message_post')( |
|
|
|
|
|
|
|
|
getattr(self, 'message_post')( |
|
|
subtype='mt_comment', |
|
|
subtype='mt_comment', |
|
|
body=_( |
|
|
|
|
|
'A review was rejected by %s.' |
|
|
|
|
|
) % (self.env.user.name) |
|
|
|
|
|
|
|
|
body=self._notify_rejected_review_body() |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|