diff --git a/hr_timesheet_sheet_current/README.rst b/hr_timesheet_sheet_current/README.rst new file mode 100644 index 0000000..09cec2e --- /dev/null +++ b/hr_timesheet_sheet_current/README.rst @@ -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 `_. +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Coop IT Easy SC + +Contributors +~~~~~~~~~~~~ + +* `Coop IT Easy SC `_: + + * victor champonnois + +Maintainers +~~~~~~~~~~~ + +This module is part of the `coopiteasy/cie-timesheet `_ project on GitHub. + +You are welcome to contribute. diff --git a/hr_timesheet_sheet_current/__init__.py b/hr_timesheet_sheet_current/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/hr_timesheet_sheet_current/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/hr_timesheet_sheet_current/__manifest__.py b/hr_timesheet_sheet_current/__manifest__.py new file mode 100644 index 0000000..0c65ca8 --- /dev/null +++ b/hr_timesheet_sheet_current/__manifest__.py @@ -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": [], +} diff --git a/hr_timesheet_sheet_current/i18n/hr_timesheet_sheet_current.pot b/hr_timesheet_sheet_current/i18n/hr_timesheet_sheet_current.pot new file mode 100644 index 0000000..937000a --- /dev/null +++ b/hr_timesheet_sheet_current/i18n/hr_timesheet_sheet_current.pot @@ -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 "" + diff --git a/hr_timesheet_sheet_current/models/__init__.py b/hr_timesheet_sheet_current/models/__init__.py new file mode 100644 index 0000000..5858a81 --- /dev/null +++ b/hr_timesheet_sheet_current/models/__init__.py @@ -0,0 +1 @@ +from . import hr_timesheet_sheet diff --git a/hr_timesheet_sheet_current/models/hr_timesheet_sheet.py b/hr_timesheet_sheet_current/models/hr_timesheet_sheet.py new file mode 100644 index 0000000..0f56d5d --- /dev/null +++ b/hr_timesheet_sheet_current/models/hr_timesheet_sheet.py @@ -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 diff --git a/hr_timesheet_sheet_current/readme/CONTRIBUTORS.rst b/hr_timesheet_sheet_current/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..7084f23 --- /dev/null +++ b/hr_timesheet_sheet_current/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Coop IT Easy SC `_: + + * victor champonnois diff --git a/hr_timesheet_sheet_current/readme/DESCRIPTION.rst b/hr_timesheet_sheet_current/readme/DESCRIPTION.rst new file mode 100644 index 0000000..a33b099 --- /dev/null +++ b/hr_timesheet_sheet_current/readme/DESCRIPTION.rst @@ -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. diff --git a/hr_timesheet_sheet_current/static/description/index.html b/hr_timesheet_sheet_current/static/description/index.html new file mode 100644 index 0000000..e9084f9 --- /dev/null +++ b/hr_timesheet_sheet_current/static/description/index.html @@ -0,0 +1,418 @@ + + + + + + +My Current Timesheet Sheet + + + +
+

My Current Timesheet Sheet

+ + +

Beta License: AGPL-3 coopiteasy/cie-timesheet

+

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

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Coop IT Easy SC
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the coopiteasy/cie-timesheet project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/hr_timesheet_sheet_current/views/hr_timesheet_sheet.xml b/hr_timesheet_sheet_current/views/hr_timesheet_sheet.xml new file mode 100644 index 0000000..2ecd35b --- /dev/null +++ b/hr_timesheet_sheet_current/views/hr_timesheet_sheet.xml @@ -0,0 +1,22 @@ + + + + + My Current Timesheet Sheet + + code + + action = model.get_current_timesheet() + + + + + + + diff --git a/setup/hr_timesheet_sheet_current/odoo/addons/hr_timesheet_sheet_current b/setup/hr_timesheet_sheet_current/odoo/addons/hr_timesheet_sheet_current new file mode 120000 index 0000000..696ddfb --- /dev/null +++ b/setup/hr_timesheet_sheet_current/odoo/addons/hr_timesheet_sheet_current @@ -0,0 +1 @@ +../../../../hr_timesheet_sheet_current \ No newline at end of file diff --git a/setup/hr_timesheet_sheet_current/setup.py b/setup/hr_timesheet_sheet_current/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/hr_timesheet_sheet_current/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)