Browse Source

Merge pull request #63 from etobella/11.0-imp-base_tier_validation_chatter

[IMP] base_tier_validation: Add a chatter message if the model has it
pull/65/head
Jordi Ballester Alomar 6 years ago
committed by GitHub
parent
commit
9f9cd8007b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      base_tier_validation/__manifest__.py
  2. 28
      base_tier_validation/models/tier_validation.py

2
base_tier_validation/__manifest__.py

@ -3,7 +3,7 @@
{
"name": "Base Tier Validation",
"summary": "Implement a validation process based on tiers.",
"version": "11.0.2.0.0",
"version": "11.0.2.0.1",
"development_status": "Mature",
"maintainers": ['lreficent'],
"category": "Tools",

28
base_tier_validation/models/tier_validation.py

@ -154,7 +154,20 @@ class TierValidation(models.AbstractModel):
'done_by': self.env.user.id,
'reviewed_date': fields.Datetime.now(),
})
# TODO: add message_post
for review in user_reviews:
rec = self.env[review.model].browse(review.res_id)
rec._notify_accepted_reviews()
def _notify_accepted_reviews(self):
if hasattr(self, 'message_post'):
# Notify state change
getattr(self, 'message_post')(
subtype='mt_comment',
body=self._notify_accepted_reviews_body()
)
def _notify_accepted_reviews_body(self):
return _('A review was accepted')
@api.multi
def validate_tier(self):
@ -173,7 +186,18 @@ class TierValidation(models.AbstractModel):
'done_by': self.env.user.id,
'reviewed_date': fields.Datetime.now(),
})
# TODO: Add 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
getattr(self, 'message_post')(
subtype='mt_comment',
body=self._notify_rejected_review_body()
)
@api.multi
def request_validation(self):

Loading…
Cancel
Save