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

[16.0] [MIG] hr_timesheet_sheet_current #28

Merged
merged 11 commits into from
Dec 19, 2023
61 changes: 61 additions & 0 deletions hr_timesheet_sheet_current/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
==========================
My Current Timesheet Sheet
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-coopiteasy%2Fcie--timesheet-lightgray.png?logo=github
:target: https://github.com/coopiteasy/cie-timesheet/tree/12.0/hr_timesheet_sheet_current
:alt: coopiteasy/cie-timesheet

|badge1| |badge2| |badge3|

Allow to access the current timesheet sheet directly from the menu.

A new menu is added to the Timesheet module, pointing directly to the user's current timesheet sheet.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/cie-timesheet/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/coopiteasy/cie-timesheet/issues/new?body=module:%20hr_timesheet_sheet_current%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* victor champonnois

Maintainers
~~~~~~~~~~~

This module is part of the `coopiteasy/cie-timesheet <https://github.com/coopiteasy/cie-timesheet/tree/12.0/hr_timesheet_sheet_current>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions hr_timesheet_sheet_current/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions hr_timesheet_sheet_current/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2021 Victor Champonnois
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "My Current Timesheet Sheet",
"summary": """
Allow to access the current timesheet sheet directly from the menu""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Coop IT Easy SC",
"website": "https://github.com/coopiteasy/cie-timesheet",
"depends": [
"hr_timesheet_sheet",
],
"data": ["views/hr_timesheet_sheet.xml"],
"demo": [],
}
32 changes: 32 additions & 0 deletions hr_timesheet_sheet_current/i18n/hr_timesheet_sheet_current.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_timesheet_sheet_current
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: hr_timesheet_sheet_current
#: model:ir.actions.server,name:hr_timesheet_sheet_current.action_hr_timesheet_current_open
#: model:ir.ui.menu,name:hr_timesheet_sheet_current.menu_act_hr_timesheet_sheet_form_my_current
msgid "My Current Timesheet Sheet"
msgstr ""

#. module: hr_timesheet_sheet_current
#: code:addons/hr_timesheet_sheet_current/models/hr_timesheet_sheet.py:26
#, python-format
msgid "Open Timesheet"
msgstr ""

#. module: hr_timesheet_sheet_current
#: model:ir.model,name:hr_timesheet_sheet_current.model_hr_timesheet_sheet
msgid "Timesheet Sheet"
msgstr ""

1 change: 1 addition & 0 deletions hr_timesheet_sheet_current/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import hr_timesheet_sheet
36 changes: 36 additions & 0 deletions hr_timesheet_sheet_current/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import datetime

from odoo import api, models
from odoo.tools.translate import _


class Sheet(models.Model):
_inherit = "hr_timesheet.sheet"

@api.model
def get_current_timesheet(self):
ts = self.env["hr_timesheet.sheet"]
today_date = datetime.date.today()
ids = ts.search(
[
("user_id", "=", self.env.uid),
("state", "in", ("draft", "new")),
("date_start", "<=", today_date),
("date_end", ">=", today_date),
]
)
view_type = "form,tree"

context = self.env.context
action = {
"name": _("Open Timesheet"),
"view_type": "form",
"view_mode": view_type,
"res_model": "hr_timesheet.sheet",
"view_id": False,
"type": "ir.actions.act_window",
"context": context,
"domain": "[('user_id', '=', uid)]",
"res_id": ids.id,
}
return action
3 changes: 3 additions & 0 deletions hr_timesheet_sheet_current/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* victor champonnois
3 changes: 3 additions & 0 deletions hr_timesheet_sheet_current/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Allow to access the current timesheet sheet directly from the menu.

A new menu is added to the Timesheet module, pointing directly to the user's current timesheet sheet.
Loading
Loading