[FIX] hr_holidays: allow edition of validated leaves

Due to a record rule, it is not possible to add a follower to a
validated leave, as we should be able to do it, we subscribe through
sudo.
This commit is contained in:
RomainLibert
2018-04-09 17:50:59 +02:00
parent c1530f219b
commit 565ab7a2e4
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -550,3 +550,10 @@ class HolidaysRequest(models.Model):
})
return [new_group] + groups
@api.multi
def message_subscribe(self, partner_ids=None, channel_ids=None, subtype_ids=None, force=True):
# due to record rule can not allow to add follower and mention on validated leave so subscribe through sudo
if self.state in ['validate', 'validate1']:
return super(HolidaysRequest, self.sudo()).message_subscribe(partner_ids=partner_ids, channel_ids=channel_ids, subtype_ids=subtype_ids, force=force)
return super(HolidaysRequest, self).message_subscribe(partner_ids=partner_ids, channel_ids=channel_ids, subtype_ids=subtype_ids, force=force)
@@ -385,3 +385,10 @@ class HolidaysAllocation(models.Model):
})
return [new_group] + groups
@api.multi
def message_subscribe(self, partner_ids=None, channel_ids=None, subtype_ids=None, force=True):
# due to record rule can not allow to add follower and mention on validated leave so subscribe through sudo
if self.state in ['validate', 'validate1']:
return super(HolidaysAllocation, self.sudo()).message_subscribe(partner_ids=partner_ids, channel_ids=channel_ids, subtype_ids=subtype_ids, force=force)
return super(HolidaysAllocation, self).message_subscribe(partner_ids=partner_ids, channel_ids=channel_ids, subtype_ids=subtype_ids, force=force)