Skip to content

Commit

Permalink
[IMP] portal_holidays: allow creating new leave allocation request
Browse files Browse the repository at this point in the history
  • Loading branch information
ced-adhoc committed Feb 7, 2025
1 parent 28b2b82 commit a22af70
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion portal_holidays/models/hr_leave_allocation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import fields, models
from odoo import api, fields, models


class HolidaysAllocation(models.Model):
Expand All @@ -9,3 +9,14 @@ class HolidaysAllocation(models.Model):
employee_overtime = fields.Float(
related="employee_id.total_overtime", groups="base.group_user,portal_holidays.group_portal_backend_holiday"
)

@api.model_create_multi
def create(self, vals_list):
"""
Allows portal holidays users to create allocation records
and ensures proper follower subscriptions.
"""
if self.env.user.has_group("portal_holidays.group_portal_backend_holiday"):
self = self.sudo()

return super(HolidaysAllocation, self).create(vals_list) # , self.with_context(mail_create_nosubscribe=True)

0 comments on commit a22af70

Please sign in to comment.