Browse Source

[IMP] base_tier_validation: Add a chatter message if the model has it

pull/63/head
Enric Tobella 6 years ago
parent
commit
ba6ca5b5fa
  1. 2
      base_tier_validation/__manifest__.py
  2. 18
      base_tier_validation/models/tier_validation.py

2
base_tier_validation/__manifest__.py

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

18
base_tier_validation/models/tier_validation.py

@ -154,7 +154,14 @@ 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(),
}) })
# TODO: add message_post
for review in user_reviews:
rec = self.env[review.model].browse(review.res_id)
if hasattr(rec, 'message_post'):
# Notify state change
getattr(rec, 'message_post')(
subtype='mt_comment',
body=_('A review was accepted')
)
@api.multi @api.multi
def validate_tier(self): def validate_tier(self):
@ -173,7 +180,14 @@ 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(),
}) })
# TODO: Add Message_post
if hasattr(rec, 'message_post'):
# Notify state change
getattr(rec, 'message_post')(
subtype='mt_comment',
body=_(
'A review was rejected by %s.'
) % (self.env.user.name)
)
@api.multi @api.multi
def request_validation(self): def request_validation(self):

Loading…
Cancel
Save