Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] portal_holidays: allow create new leave allocation request #239

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)