[ADD] hr_timesheet_sheet_usability_akretion
This commit is contained in:
1
hr_timesheet_sheet_usability_akretion/models/__init__.py
Normal file
1
hr_timesheet_sheet_usability_akretion/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import hr_timesheet_sheet
|
||||
@@ -0,0 +1,28 @@
|
||||
# Copyright 2025 Akretion France (https://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class HrTimesheetSheet(models.Model):
|
||||
_inherit = 'hr_timesheet.sheet'
|
||||
|
||||
def show_lines_fullscreen(self):
|
||||
self.ensure_one()
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
"hr_timesheet.timesheet_action_all")
|
||||
action['domain'] = [('sheet_id', '=', self.id)]
|
||||
return action
|
||||
|
||||
# Inherit native method. We don't want tons of followers by default. We just want the manager.
|
||||
def _get_subscribers(self):
|
||||
self.ensure_one()
|
||||
subscribers = self._get_informables()
|
||||
return subscribers
|
||||
|
||||
def _check_can_review(self):
|
||||
if self.employee_id.user_id == self.env.user and self.employee_id.parent_id:
|
||||
raise UserError(_("You cannot approve your own timesheet!"))
|
||||
return super()._check_can_review()
|
||||
Reference in New Issue
Block a user