[ADD] hr_timesheet_sheet_usability_akretion

This commit is contained in:
Alexis de Lattre
2025-09-05 17:48:13 +00:00
parent dc00366d80
commit 9769393759
5 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,18 @@
# Copyright 2025 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'HR Timesheet Sheet Usability Akretion',
'version': '16.0.1.0.0',
'category': 'Timesheet',
'license': 'AGPL-3',
'summary': 'Better usability in hr_timesheet_sheet module',
'author': 'Akretion',
'website': 'https://github.com/akretion/odoo-usability',
'depends': ['hr_timesheet_sheet'],
'data': [
'views/hr_timesheet_sheet.xml',
],
'installable': True,
}

View File

@@ -0,0 +1 @@
from . import hr_timesheet_sheet

View File

@@ -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()

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="hr_timesheet_sheet_form" model="ir.ui.view">
<field name="model">hr_timesheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet/field[@name='name']" position="before">
<div class="oe_button_box" name="button_box">
<button name="show_lines_fullscreen" type="object"
class="oe_stat_button" icon="fa-bars" string="Détails plein écran"/>
</div>
</xpath>
</field>
</record>
</odoo>