diff --git a/hr_timesheet_day_week/README.rst b/hr_timesheet_day_week/README.rst new file mode 100644 index 0000000000..6c4716c88d --- /dev/null +++ b/hr_timesheet_day_week/README.rst @@ -0,0 +1,111 @@ +======================== +Timesheets - Day of Week +======================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7a86c322dbe32ae0db935799f30e6c257784d7ea7b3093829025dd2fca7aa6fd + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-OCA%2Ftimesheet-lightgray.png?logo=github + :target: https://github.com/OCA/timesheet/tree/17.0/hr_timesheet_day_week + :alt: OCA/timesheet +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/timesheet-17-0/timesheet-17-0-hr_timesheet_day_week + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/timesheet&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +For timesheets, enables search, group by the day of the week. This is +useful when e.g. weekend timesheets needs to be located. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Now it's possible to search by and/or group by day of week for +timesheets: + +|Search by day of week| + +|Group by day of week| + +For timesheet and timesheet report list views, it's possible to view in +a different color those timesheets that belong to weekends: + +|Colored list| + +and additionally use a filter for them: + +|Filter by weekend timesheets| + +.. |Search by day of week| image:: https://raw.githubusercontent.com/OCA/timesheet/17.0/hr_timesheet_day_week/static/img/01_search.png +.. |Group by day of week| image:: https://raw.githubusercontent.com/OCA/timesheet/17.0/hr_timesheet_day_week/static/img/02_groupby.png +.. |Colored list| image:: https://raw.githubusercontent.com/OCA/timesheet/17.0/hr_timesheet_day_week/static/img/03_list.png +.. |Filter by weekend timesheets| image:: https://raw.githubusercontent.com/OCA/timesheet/17.0/hr_timesheet_day_week/static/img/04_filter.png + +Known issues / Roadmap +====================== + +- Make weekend definition parametrized, as there are countries around + the world that their weekend days are different than usual western + Saturday and Sunday days. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Solvos + +Contributors +------------ + +- `Solvos `__: + + - David Alonso + - Adrián Resúa + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/timesheet `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_timesheet_day_week/__init__.py b/hr_timesheet_day_week/__init__.py new file mode 100644 index 0000000000..9058cf04af --- /dev/null +++ b/hr_timesheet_day_week/__init__.py @@ -0,0 +1,3 @@ +from .hooks import pre_init_hook +from . import models +from . import report diff --git a/hr_timesheet_day_week/__manifest__.py b/hr_timesheet_day_week/__manifest__.py new file mode 100644 index 0000000000..d3dfcf5fb9 --- /dev/null +++ b/hr_timesheet_day_week/__manifest__.py @@ -0,0 +1,15 @@ +# © 2025 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + "name": "Timesheets - Day of Week", + "category": "Human Resources", + "version": "17.0.1.0.0", + "depends": ["hr_timesheet"], + "data": ["views/hr_timesheet_view.xml"], + "author": "Solvos, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/timesheet", + "license": "AGPL-3", + "pre_init_hook": "pre_init_hook", + "installable": True, +} diff --git a/hr_timesheet_day_week/hooks.py b/hr_timesheet_day_week/hooks.py new file mode 100644 index 0000000000..586040b320 --- /dev/null +++ b/hr_timesheet_day_week/hooks.py @@ -0,0 +1,30 @@ +# © 2025 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +import logging + +from odoo.tools.sql import column_exists + +logger = logging.getLogger(__name__) + + +def pre_init_hook(env): + if not column_exists(env.cr, "account_analytic_line", "day_week"): + logger.info("Creating field day_week on account_analytic_line") + env.cr.execute( + """ + ALTER TABLE account_analytic_line + ADD COLUMN day_week character varying + """ + ) + logger.info("Updating field day_week for account_analytic_line records") + env.cr.execute( + """ + UPDATE account_analytic_line + SET day_week = ( + CASE DATE_PART('dow', date) + WHEN 0 THEN 6 + ELSE DATE_PART('dow', date) - 1 + END)::character varying + """ + ) diff --git a/hr_timesheet_day_week/i18n/es.po b/hr_timesheet_day_week/i18n/es.po new file mode 100644 index 0000000000..ad4e28ba01 --- /dev/null +++ b/hr_timesheet_day_week/i18n/es.po @@ -0,0 +1,82 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_timesheet_day_week +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-07-01 17:49+0000\n" +"PO-Revision-Date: 2025-07-01 19:50+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4.2\n" + +#. module: hr_timesheet_day_week +#: model:ir.model,name:hr_timesheet_day_week.model_account_analytic_line +msgid "Analytic Line" +msgstr "Línea analítica" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields,field_description:hr_timesheet_day_week.field_account_analytic_line__day_week +#: model:ir.model.fields,field_description:hr_timesheet_day_week.field_timesheets_analysis_report__day_week +#: model_terms:ir.ui.view,arch_db:hr_timesheet_day_week.hr_timesheet_line_search +msgid "Day of Week" +msgstr "Día de la semana" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__4 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__4 +msgid "Friday" +msgstr "Viernes" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__0 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__0 +msgid "Monday" +msgstr "Lunes" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__5 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__5 +msgid "Saturday" +msgstr "Sábado" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__6 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__6 +msgid "Sunday" +msgstr "Domingo" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__3 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__3 +msgid "Thursday" +msgstr "Jueves" + +#. module: hr_timesheet_day_week +#: model:ir.model,name:hr_timesheet_day_week.model_timesheets_analysis_report +msgid "Timesheets Analysis Report" +msgstr "Informe de análisis de partes de horas" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__1 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__1 +msgid "Tuesday" +msgstr "Martes" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__2 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__2 +msgid "Wednesday" +msgstr "Miércoles" + +#. module: hr_timesheet_day_week +#: model_terms:ir.ui.view,arch_db:hr_timesheet_day_week.hr_timesheet_line_search +msgid "Weekend" +msgstr "Fin de semana" diff --git a/hr_timesheet_day_week/i18n/hr_timesheet_day_week.pot b/hr_timesheet_day_week/i18n/hr_timesheet_day_week.pot new file mode 100644 index 0000000000..51b03d4b26 --- /dev/null +++ b/hr_timesheet_day_week/i18n/hr_timesheet_day_week.pot @@ -0,0 +1,78 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_timesheet_day_week +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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_day_week +#: model:ir.model,name:hr_timesheet_day_week.model_account_analytic_line +msgid "Analytic Line" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields,field_description:hr_timesheet_day_week.field_account_analytic_line__day_week +#: model:ir.model.fields,field_description:hr_timesheet_day_week.field_timesheets_analysis_report__day_week +#: model_terms:ir.ui.view,arch_db:hr_timesheet_day_week.hr_timesheet_line_search +msgid "Day of Week" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__4 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__4 +msgid "Friday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__0 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__0 +msgid "Monday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__5 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__5 +msgid "Saturday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__6 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__6 +msgid "Sunday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__3 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__3 +msgid "Thursday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model,name:hr_timesheet_day_week.model_timesheets_analysis_report +msgid "Timesheets Analysis Report" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__1 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__1 +msgid "Tuesday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__2 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__2 +msgid "Wednesday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model_terms:ir.ui.view,arch_db:hr_timesheet_day_week.hr_timesheet_line_search +msgid "Weekend" +msgstr "" diff --git a/hr_timesheet_day_week/i18n/it.po b/hr_timesheet_day_week/i18n/it.po new file mode 100644 index 0000000000..cb6b4f6f9b --- /dev/null +++ b/hr_timesheet_day_week/i18n/it.po @@ -0,0 +1,79 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_timesheet_day_week +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: hr_timesheet_day_week +#: model:ir.model,name:hr_timesheet_day_week.model_account_analytic_line +msgid "Analytic Line" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields,field_description:hr_timesheet_day_week.field_account_analytic_line__day_week +#: model:ir.model.fields,field_description:hr_timesheet_day_week.field_timesheets_analysis_report__day_week +#: model_terms:ir.ui.view,arch_db:hr_timesheet_day_week.hr_timesheet_line_search +msgid "Day of Week" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__4 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__4 +msgid "Friday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__0 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__0 +msgid "Monday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__5 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__5 +msgid "Saturday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__6 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__6 +msgid "Sunday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__3 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__3 +msgid "Thursday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model,name:hr_timesheet_day_week.model_timesheets_analysis_report +msgid "Timesheets Analysis Report" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__1 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__1 +msgid "Tuesday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__account_analytic_line__day_week__2 +#: model:ir.model.fields.selection,name:hr_timesheet_day_week.selection__timesheets_analysis_report__day_week__2 +msgid "Wednesday" +msgstr "" + +#. module: hr_timesheet_day_week +#: model_terms:ir.ui.view,arch_db:hr_timesheet_day_week.hr_timesheet_line_search +msgid "Weekend" +msgstr "" diff --git a/hr_timesheet_day_week/models/__init__.py b/hr_timesheet_day_week/models/__init__.py new file mode 100644 index 0000000000..9776396461 --- /dev/null +++ b/hr_timesheet_day_week/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import account_analytic_line diff --git a/hr_timesheet_day_week/models/account_analytic_line.py b/hr_timesheet_day_week/models/account_analytic_line.py new file mode 100644 index 0000000000..611929e213 --- /dev/null +++ b/hr_timesheet_day_week/models/account_analytic_line.py @@ -0,0 +1,28 @@ +# © 2025 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo import api, fields, models + +WEEKDAYS = [ + ("0", "Monday"), + ("1", "Tuesday"), + ("2", "Wednesday"), + ("3", "Thursday"), + ("4", "Friday"), + ("5", "Saturday"), + ("6", "Sunday"), +] + + +class AccountAnalyticLine(models.Model): + _inherit = "account.analytic.line" + + day_week = fields.Selection( + WEEKDAYS, compute="_compute_week_day", store=True, string="Day of Week" + ) + + @api.depends("date") + def _compute_week_day(self): + for record in self: + week_day = record.date.weekday() + record.day_week = str(week_day) diff --git a/hr_timesheet_day_week/pyproject.toml b/hr_timesheet_day_week/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/hr_timesheet_day_week/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/hr_timesheet_day_week/readme/CONTRIBUTORS.md b/hr_timesheet_day_week/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..1f53d8414b --- /dev/null +++ b/hr_timesheet_day_week/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- [Solvos](https://www.solvos.es): + + > - David Alonso + > - Adrián Resúa diff --git a/hr_timesheet_day_week/readme/DESCRIPTION.md b/hr_timesheet_day_week/readme/DESCRIPTION.md new file mode 100644 index 0000000000..afc3c5aac7 --- /dev/null +++ b/hr_timesheet_day_week/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +For timesheets, enables search, group by the day of the week. +This is useful when e.g. weekend timesheets needs to be located. diff --git a/hr_timesheet_day_week/readme/ROADMAP.md b/hr_timesheet_day_week/readme/ROADMAP.md new file mode 100644 index 0000000000..769368c5d2 --- /dev/null +++ b/hr_timesheet_day_week/readme/ROADMAP.md @@ -0,0 +1 @@ +- Make weekend definition parametrized, as there are countries around the world that their weekend days are different than usual western Saturday and Sunday days. diff --git a/hr_timesheet_day_week/readme/USAGE.md b/hr_timesheet_day_week/readme/USAGE.md new file mode 100644 index 0000000000..1d37853d24 --- /dev/null +++ b/hr_timesheet_day_week/readme/USAGE.md @@ -0,0 +1,14 @@ +Now it's possible to search by and/or group by day of week for timesheets: + +![Search by day of week](../static/img/01_search.png) + +![Group by day of week](../static/img/02_groupby.png) + +For timesheet and timesheet report list views, it's possible to view in a +different color those timesheets that belong to weekends: + +![Colored list](../static/img/03_list.png) + +and additionally use a filter for them: + +![Filter by weekend timesheets](../static/img/04_filter.png) diff --git a/hr_timesheet_day_week/report/__init__.py b/hr_timesheet_day_week/report/__init__.py new file mode 100644 index 0000000000..caf050abc6 --- /dev/null +++ b/hr_timesheet_day_week/report/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import timesheets_analysis_report diff --git a/hr_timesheet_day_week/report/timesheets_analysis_report.py b/hr_timesheet_day_week/report/timesheets_analysis_report.py new file mode 100644 index 0000000000..f07647f982 --- /dev/null +++ b/hr_timesheet_day_week/report/timesheets_analysis_report.py @@ -0,0 +1,15 @@ +# © 2025 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo import fields, models + +from ..models.account_analytic_line import WEEKDAYS + + +class TimesheetsAnalysisReport(models.Model): + _inherit = "timesheets.analysis.report" + + day_week = fields.Selection(WEEKDAYS, string="Day of Week", readonly=True) + + def _select(self): + return super()._select() + ", A.day_week AS day_week" diff --git a/hr_timesheet_day_week/static/description/icon.png b/hr_timesheet_day_week/static/description/icon.png new file mode 100644 index 0000000000..1dcc49c24f Binary files /dev/null and b/hr_timesheet_day_week/static/description/icon.png differ diff --git a/hr_timesheet_day_week/static/description/index.html b/hr_timesheet_day_week/static/description/index.html new file mode 100644 index 0000000000..c67829e062 --- /dev/null +++ b/hr_timesheet_day_week/static/description/index.html @@ -0,0 +1,453 @@ + + + + + +Timesheets - Day of Week + + + +
+

Timesheets - Day of Week

+ + +

Beta License: AGPL-3 OCA/timesheet Translate me on Weblate Try me on Runboat

+

For timesheets, enables search, group by the day of the week. This is +useful when e.g. weekend timesheets needs to be located.

+

Table of contents

+ +
+

Usage

+

Now it’s possible to search by and/or group by day of week for +timesheets:

+

Search by day of week

+

Group by day of week

+

For timesheet and timesheet report list views, it’s possible to view in +a different color those timesheets that belong to weekends:

+

Colored list

+

and additionally use a filter for them:

+

Filter by weekend timesheets

+
+
+

Known issues / Roadmap

+
    +
  • Make weekend definition parametrized, as there are countries around +the world that their weekend days are different than usual western +Saturday and Sunday days.
  • +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Solvos
  • +
+
+
+

Contributors

+
    +
  • Solvos:

    +
    +
      +
    • David Alonso
    • +
    • Adrián Resúa
    • +
    +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/timesheet project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/hr_timesheet_day_week/static/img/01_search.png b/hr_timesheet_day_week/static/img/01_search.png new file mode 100644 index 0000000000..cd390ad090 Binary files /dev/null and b/hr_timesheet_day_week/static/img/01_search.png differ diff --git a/hr_timesheet_day_week/static/img/02_groupby.png b/hr_timesheet_day_week/static/img/02_groupby.png new file mode 100644 index 0000000000..9234903d62 Binary files /dev/null and b/hr_timesheet_day_week/static/img/02_groupby.png differ diff --git a/hr_timesheet_day_week/static/img/03_list.png b/hr_timesheet_day_week/static/img/03_list.png new file mode 100644 index 0000000000..98665c6b5f Binary files /dev/null and b/hr_timesheet_day_week/static/img/03_list.png differ diff --git a/hr_timesheet_day_week/static/img/04_filter.png b/hr_timesheet_day_week/static/img/04_filter.png new file mode 100644 index 0000000000..9fee6f0e44 Binary files /dev/null and b/hr_timesheet_day_week/static/img/04_filter.png differ diff --git a/hr_timesheet_day_week/tests/__init__.py b/hr_timesheet_day_week/tests/__init__.py new file mode 100644 index 0000000000..c22f43586d --- /dev/null +++ b/hr_timesheet_day_week/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import test_hr_timesheet_day_week diff --git a/hr_timesheet_day_week/tests/test_hr_timesheet_day_week.py b/hr_timesheet_day_week/tests/test_hr_timesheet_day_week.py new file mode 100644 index 0000000000..6fc83be5f9 --- /dev/null +++ b/hr_timesheet_day_week/tests/test_hr_timesheet_day_week.py @@ -0,0 +1,44 @@ +# © 2025 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from datetime import date, timedelta + +from odoo.addons.base.tests.common import BaseCommon + + +class TestHrTimesheetDayWeek(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.timesheet_line_model = cls.env["account.analytic.line"] + cls.analytic_plan = cls.env["account.analytic.plan"].create( + {"name": "Test Plan", "default_applicability": "optional"} + ) + cls.analytic = cls.env["account.analytic.account"].create( + { + "name": "Test Analytic Account", + "plan_id": cls.analytic_plan.id, + "company_id": False, + } + ) + cls.user = cls.env.ref("base.user_root") + # 2024-10-14 was a Monday = day "0" of a week + cls.base_date = date(2024, 10, 14) + cls.base_line = { + "name": "test", + "date": cls.base_date, + "user_id": cls.user.id, + "unit_amount": 2.0, + "account_id": cls.analytic.id, + "amount": -60.0, + } + + def test_01_week_day(self): + timesheet = self.timesheet_line_model.create(self.base_line) + for i in range(0, 7): + timesheet.date = self.base_date + timedelta(days=i) + self.assertEqual(timesheet.day_week, str(i)) + + def test_02_week_day_report(self): + timesheet_rpt = self.env["timesheets.analysis.report"].browse([]) + self.assertTrue(timesheet_rpt._select(), "A.day_week AS day_week") diff --git a/hr_timesheet_day_week/views/hr_timesheet_view.xml b/hr_timesheet_day_week/views/hr_timesheet_view.xml new file mode 100644 index 0000000000..6bb2c3e31e --- /dev/null +++ b/hr_timesheet_day_week/views/hr_timesheet_view.xml @@ -0,0 +1,45 @@ + + + account.analytic.line.search (in hr_timesheet_day_week) + account.analytic.line + + + + + + + + + + + + + + + + + account.analytic.line.list.hr_timesheet (in hr_timesheet_day_week) + account.analytic.line + + + + day_week in ['5', '6'] + + + + + + +