[ADD] hr_timesheet_sheet_usability_akretion
This commit is contained in:
1
hr_timesheet_sheet_usability_akretion/__init__.py
Normal file
1
hr_timesheet_sheet_usability_akretion/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
18
hr_timesheet_sheet_usability_akretion/__manifest__.py
Normal file
18
hr_timesheet_sheet_usability_akretion/__manifest__.py
Normal 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,
|
||||||
|
}
|
||||||
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()
|
||||||
@@ -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>
|
||||||
Reference in New Issue
Block a user