diff --git a/beesdoo_website_shift/__init__.py b/beesdoo_website_shift/__init__.py new file mode 100644 index 0000000..e046e49 --- /dev/null +++ b/beesdoo_website_shift/__init__.py @@ -0,0 +1 @@ +from . import controllers diff --git a/beesdoo_website_shift/__openerp__.py b/beesdoo_website_shift/__openerp__.py new file mode 100644 index 0000000..ea05970 --- /dev/null +++ b/beesdoo_website_shift/__openerp__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +{ + 'name': 'Beescoop Shift Website', + + 'summary': """ + Show available shifts for regular and irregular workers in + portal. + """, + 'description': """ + """, + + 'author': 'Rémy Taymans', + 'website': "https://github.com/beescoop/Obeesdoo", + + 'category': 'Cooperative management', + 'version': '0.1', + + 'depends': ['website', 'beesdoo_shift'], + + 'data': [ + 'views/shift_website_templates.xml', + 'data/config_data.xml', + ] +} diff --git a/beesdoo_website_shift/controllers/__init__.py b/beesdoo_website_shift/controllers/__init__.py new file mode 100644 index 0000000..12a7e52 --- /dev/null +++ b/beesdoo_website_shift/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/beesdoo_website_shift/controllers/main.py b/beesdoo_website_shift/controllers/main.py new file mode 100644 index 0000000..14f205a --- /dev/null +++ b/beesdoo_website_shift/controllers/main.py @@ -0,0 +1,41 @@ +# -*- coding: utf8 -*- +from datetime import datetime +from itertools import groupby +from openerp import http +from openerp.http import request + +from openerp.addons.beesdoo_shift.models.planning import float_to_time + +class ShiftPortalController(http.Controller): + + @http.route('/shift_irregular_worker', auth='public', website=True) + def shift_irregular_worker(self, **kwargs): + # Get all the shifts in the future with no worker + now = datetime.now() + shifts = request.env['beesdoo.shift.shift'].sudo().search( + [('start_time', '>', now.strftime("%Y-%m-%d %H:%M:%S")), + ('worker_id', '=', False)], + order="start_time, task_template_id, task_type_id", + ) + + shifts_and_count = [] + for _, val in groupby(shifts, lambda s: s.task_template_id): + s = [v for v in val] + shifts_and_count.append([len(s), s[0]]) + + return request.render('beesdoo_website_shift.shift_template', + {'shift_templates': shifts_and_count} + ) + + @http.route('/shift_template_regular_worker', auth='public', website=True) + def shift_template_regular_worker(self, **kwargs): + # Get all the task template + template = request.env['beesdoo.shift.template'] + task_templates = template.sudo().search([], order="planning_id, day_nb_id, start_time") + + return request.render('beesdoo_website_shift.task_template', + { + 'task_templates': task_templates, + 'float_to_time': float_to_time + } + ) \ No newline at end of file diff --git a/beesdoo_website_shift/data/config_data.xml b/beesdoo_website_shift/data/config_data.xml new file mode 100644 index 0000000..f028307 --- /dev/null +++ b/beesdoo_website_shift/data/config_data.xml @@ -0,0 +1,17 @@ + + + + + Shifts Irregular + /shift_irregular_worker + + 50 + + + Shifts Regular + /shift_template_regular_worker + + 51 + + + diff --git a/beesdoo_website_shift/i18n/fr_BE.po b/beesdoo_website_shift/i18n/fr_BE.po new file mode 100644 index 0000000..605ffd5 --- /dev/null +++ b/beesdoo_website_shift/i18n/fr_BE.po @@ -0,0 +1,122 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * beesdoo_portal_shift +# +# Tanslators: +# Rémy Taymans , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-09-29 09:02+0000\n" +"PO-Revision-Date: 2017-09-29 11:08+0200\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: fr_BE\n" +"X-Generator: Poedit 1.8.11\n" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Available Tasks Templates for Regular Workers" +msgstr "Créneaux disponibles pour les travailleurs réguliers" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +msgid "Available Shifts for Irregular Workers" +msgstr "Shifts disponibles pour les travailleurs volants" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +msgid "Date" +msgstr "Date" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +msgid "Day" +msgstr "Jour" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Available Spaces" +msgstr "Places disponibles" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Subscribe via the member office or via" +msgstr "Inscription au bureau des membres ou via" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +msgid "Subscribe via" +msgstr "Inscription via" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Not yet" +msgstr "Pas encore" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +msgid "Shift" +msgstr "Shift" + +#. module: beesdoo_portal_shift +#: model:website.menu,name:beesdoo_portal_shift.menu_work_irregular +msgid "Shifts Irregular" +msgstr "Shifts" + +#. module: beesdoo_portal_shift +#: model:website.menu,name:beesdoo_portal_shift.menu_work_regular +msgid "Shifts Regular" +msgstr "Créneaux" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Super Co-operator" +msgstr "Super-coopérateur" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Task Template" +msgstr "Créneau" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Time" +msgstr "Heures" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +msgid "Type of Shift" +msgstr "Type de shift" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Type of Task" +msgstr "Type de créneau" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Week" +msgstr "Semaine" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "Yes" +msgstr "Oui" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.task_template +msgid "membre@bees-coop.be" +msgstr "membre@bees-coop.be" + +#. module: beesdoo_portal_shift +#: model:ir.ui.view,arch_db:beesdoo_portal_shift.shift_template +msgid "volant@bees-coop.be" +msgstr "volant@bees-coop.be" diff --git a/beesdoo_website_shift/static/src/css/design.css b/beesdoo_website_shift/static/src/css/design.css new file mode 100644 index 0000000..acfb05a --- /dev/null +++ b/beesdoo_website_shift/static/src/css/design.css @@ -0,0 +1,3 @@ +h1 { + color: grey; +} diff --git a/beesdoo_website_shift/views/shift_website_templates.xml b/beesdoo_website_shift/views/shift_website_templates.xml new file mode 100644 index 0000000..8a00e24 --- /dev/null +++ b/beesdoo_website_shift/views/shift_website_templates.xml @@ -0,0 +1,125 @@ + + + + + + + + + +