Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
3e54759
[ADD] beesdoo_shift_swap
MatteoLdx Jun 20, 2022
2d50d7e
[UPD] Update beesdoo_shift_swap.pot
Jun 20, 2022
480c0e5
[FIX] b_website_shift_swap: remove button unsubcribe on solidarity sh…
MatteoLdx Jun 20, 2022
fa9819c
[IMP] b_shift_swap: change attribute modification
MatteoLdx Jun 20, 2022
e3223a5
[REF] b_shift,b_website_shift,b_shift_swap: reorganize parameters
MatteoLdx Jun 20, 2022
c3197a5
[IMP] b_shift_swap: add implied security groups
MatteoLdx Jun 21, 2022
0290b35
[IMP] b_shift_swap,b_website_shift_swap: request solidarity for a pas…
MatteoLdx Jun 22, 2022
86d5895
[IMP] b_website_shift_swap: add parameter to control number of displa…
MatteoLdx Jun 23, 2022
4a0e0b6
[IMP] b_website_shift_swap: add readme
MatteoLdx Jun 23, 2022
38657b9
[FIX] b_shift_swap: remove is_solidarity attribute when cancelling a …
MatteoLdx Jun 23, 2022
759ea88
[FIX] b_shift_swap: update tests to match recent changes
MatteoLdx Jun 23, 2022
a223bad
[ADD] translations
MatteoLdx Jun 23, 2022
3248483
[IMP] b_shift_swap: remove parameter hours_limit_cancel_solidarity_offer
MatteoLdx Jun 24, 2022
71d082c
[FIX] b_shift_swap: update tests
MatteoLdx Jun 27, 2022
f21ce48
[UPD] Update beesdoo_shift_swap.pot
Jun 27, 2022
e9eceed
[FIX] b_shift_swap: fix tests
MatteoLdx Jun 30, 2022
3b41107
[FIX] SCRLfs → SC
carmenbianca Jun 29, 2022
a927aaf
[UPD] README.rst
github-grap-bot Jul 6, 2022
14a8f09
[IMP] b_shift_swap: update shift swap view tree to display shifts
MatteoLdx Jun 24, 2022
b02f6d5
[IMP] b_shift,b_shift_swap: faster next shifts calculation
MatteoLdx Jun 27, 2022
3dcc172
[IMP] b_shift_swap: send mail if no match found and shift is close
MatteoLdx Jun 28, 2022
16e5aff
[FIX] b_shift_swap: access rights
MatteoLdx Jun 28, 2022
cafdc9c
[IMP] b_shift_swap: cancel exchange requests when unsubscribing from …
MatteoLdx Jun 28, 2022
1fff01f
[FIX] b_shift_swap: add solidarity attributes when calculating next s…
MatteoLdx Jun 28, 2022
d67ec01
[IMP] b_shift_swap: avoid record creation outside of wizards
MatteoLdx Jun 29, 2022
27475c1
[IMP] b_shift_swap: exchange wizard update
MatteoLdx Jun 29, 2022
9e8dab4
[IMP] b_shift_swap,b_website_shift_swap,b_worker_status_shift_swap: p…
MatteoLdx Jun 30, 2022
bd9deda
[IMP] b_shift_swap,b_website_shift_swap: add exchange email unsubscri…
MatteoLdx Jun 30, 2022
03a8769
[IMP] b_website_shift,b_website_shift_swap: disabled buttons if shift…
MatteoLdx Jul 1, 2022
8c803a4
[IMP] b_shift_swap: update views
MatteoLdx Jul 1, 2022
02a40f0
[IMP] b_shift_swap,b_website_shift_swap: add a start date for shifts …
MatteoLdx Jul 1, 2022
e2b5925
[REF] b_shift_swap: change future shift calculation to evaluate excha…
MatteoLdx Jul 5, 2022
30801de
[IMP] b_shift_swap: request a solidarity shift in the past in the wizard
MatteoLdx Jul 6, 2022
d0953d2
[IMP] b_shift_swap: remove useless field date
MatteoLdx Jul 7, 2022
e5c984e
fixup! [IMP] b_shift_swap: exchange wizard update
MatteoLdx Jul 7, 2022
a1ffd1b
[IMP] b_shift_swap: search dated template by date
MatteoLdx Jul 8, 2022
a03b5ef
[IMP] b_shift_swap: add security access
MatteoLdx Jul 11, 2022
6f024d6
[FIX] b_shift_swap,b_website_shift_swap: typos, remove useless field
MatteoLdx Jul 12, 2022
d41e3cf
fixup! [IMP] b_shift_swap: add security access
MatteoLdx Jul 12, 2022
1ccea34
[FIX] b_shift_swap: deleted security groups, used beesdoo_shift ones …
MatteoLdx Jul 12, 2022
7534b18
[IMP] b_shift_swap: add mixin to handle next shifts calculation
MatteoLdx Jul 12, 2022
814bd46
[IMP] b_shift_swap: disable requesting solidarity for a past shift in…
MatteoLdx Jul 12, 2022
f63b8ac
[IMP] b_shift_swap: add email language, fix indent
MatteoLdx Jul 14, 2022
f9ded13
[IMP] b_shift,b_shift_swap: add comments
MatteoLdx Jul 14, 2022
624534f
[UPD] Update beesdoo_shift_swap.pot
Jul 18, 2022
20273ec
beesdoo_shift_swap 12.0.2.0.0
github-grap-bot Jul 18, 2022
6872c3f
[UPD] b_shift,b_shift_swap,b_website_shift,b_website_shift_swap: tran…
MatteoLdx Jul 18, 2022
0fe4d9c
beesdoo_shift_swap 12.0.2.0.1
github-grap-bot Jul 18, 2022
e199576
[IMP] b_shift_swap: small fixes, add button on shift to cancel solida…
MatteoLdx Jul 18, 2022
b2b76bf
[FIX] b_shift,b_shift_swap: conditions to display solidarity buttons …
MatteoLdx Jul 18, 2022
13a7747
[IMP] b_shift: add param to get_future_shift method to avoid cancelle…
MatteoLdx Jul 18, 2022
bef616b
[FIX] b_shift,b_shift_swap: add sudo
MatteoLdx Jul 19, 2022
22a459c
[IMP] b_shift,b_shift_swap: don't display shifts and don't send mail …
MatteoLdx Jul 19, 2022
607b8b6
[IMP] b_shift_swap: update comments
MatteoLdx Jul 20, 2022
1dc113b
[IMP] b_shift_swap: remove start date constraint for shift exchange w…
MatteoLdx Jul 22, 2022
095db27
[FIX] b_shift_swap: swap wizard, display all available shifts instead…
MatteoLdx Jul 22, 2022
d6e0656
[FIX] b_shift_swap : exchange request displayed name
MatteoLdx Jul 22, 2022
a1ae950
[UPD] Update beesdoo_shift_swap.pot
Aug 25, 2022
ba26c21
beesdoo_shift_swap 12.0.2.1.0
github-grap-bot Aug 25, 2022
84ac1b7
[REF] beesdoo.shift -> shift
carmenbianca Dec 19, 2022
276ab7e
[REF] beesdoo_shift -> shift
carmenbianca Dec 20, 2022
df6d63c
[FIX] shift: Prefix parameters in code
carmenbianca Mar 8, 2023
8cf2744
[FIX] Run pre-commit
carmenbianca Mar 9, 2023
7d31132
[FIX] beesdoo_shift_swap: Fix comment
carmenbianca Mar 24, 2023
93d4a71
[REL] increment versions of dependent modules
huguesdk Mar 24, 2023
14e7380
[UPD] Update beesdoo_shift_swap.pot
Mar 24, 2023
5c0d266
[FIX] beesdoo_shift_swap: Prevent a skip of subsequent items
carmenbianca Aug 30, 2024
e3313d0
[FIX] make changes processing code more obvious
huguesdk Nov 1, 2024
5dd24b8
[BOT] post-merge updates
github-grap-bot Nov 1, 2024
9353f86
[MIG] shift_change: Migration to versin 16.0
remytms Dec 23, 2025
2f164f6
[FIX] shift_change: fields required
remytms Feb 6, 2026
40f73c9
[ADD] shift_change_portal
remytms Feb 6, 2026
09b87a3
[IMP] shift_change: restrict shift selection in admin view
remytms Feb 24, 2026
9a36569
[IMP] shift_change_portal: test for max changes in portal
remytms Feb 24, 2026
241a2bb
[IMP] shift_change: wizard and improved ui
remytms Feb 25, 2026
6438891
[IMP] shift_change: prevent registering to a not available shift
remytms Feb 25, 2026
af31f94
[FIX] shift_change: move sibling shifts to dedicated test
remytms Feb 26, 2026
91c9812
[FIX] shift_change: loop between shift change
remytms Feb 26, 2026
58f15b9
[IMP] shift_change: description
remytms Mar 2, 2026
16e0e66
[FIX] shift, shift_change: available shifts
remytms Mar 5, 2026
79dd180
[FIX] shift_change: wizard error
remytms Mar 9, 2026
c2dfa42
[FIX] shift_change: remove duplicated demo
remytms Mar 11, 2026
26ed7c1
[IMP] shift_change, shift_change_portal: time limit for new shift
remytms Mar 11, 2026
c7000c1
[IMP] shift_change: ui for shift selection
remytms Mar 18, 2026
129cb4d
[IMP] shift_change: add wizard on res_partner form
remytms Mar 19, 2026
fcfc240
[FIX] shift_change_portal: change created when error
remytms Mar 19, 2026
fc6e434
[FIX] shift_beneficiary: generic overwrite
remytms Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup/shift_change/odoo/addons/shift_change
6 changes: 6 additions & 0 deletions setup/shift_change/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
1 change: 1 addition & 0 deletions setup/shift_change_portal/odoo/addons/shift_change_portal
6 changes: 6 additions & 0 deletions setup/shift_change_portal/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
2 changes: 1 addition & 1 deletion shift/models/cooperative_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class HistoryStatus(models.Model):
_name = "cooperative.status.history"
_description = "cooperative.status.history"

_order = "create_date desc"
_order = "create_date desc, id"

status_id = fields.Many2one("cooperative.status")
cooperator_id = fields.Many2one("res.partner")
Expand Down
6 changes: 3 additions & 3 deletions shift/models/planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ShiftDayNumber(models.Model):
_name = "shift.daynumber"
_description = "shift.daynumber"

_order = "number asc"
_order = "number asc, id"

name = fields.Char()
number = fields.Integer(
Expand All @@ -55,7 +55,7 @@ class ShiftDayNumber(models.Model):
class ShiftPlanning(models.Model):
_name = "shift.planning"
_description = "shift.planning"
_order = "sequence asc"
_order = "sequence asc, id"

sequence = fields.Integer()
name = fields.Char()
Expand Down Expand Up @@ -198,7 +198,7 @@ def get_future_shifts(
class ShiftTemplate(models.Model):
_name = "shift.template"
_description = "shift.template"
_order = "start_time"
_order = "planning_id, task_type_id, start_time, id"

name = fields.Char(required=True)
planning_id = fields.Many2one("shift.planning", required=True)
Expand Down
37 changes: 36 additions & 1 deletion shift/models/shift_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ShiftShift(models.Model):
_name = "shift.shift"
_description = "shift.shift"
_inherit = ["mail.thread"]
_order = "start_time asc"
_order = "start_time asc, task_template_id, task_type_id, worker_id, id"

##################################
# Method to override #
Expand Down Expand Up @@ -143,6 +143,41 @@ def _add_follower(self, vals):
worker = self.env["res.partner"].browse(vals["worker_id"])
self.message_subscribe(partner_ids=worker.ids)

@api.model
def _aggregate_sibling_shifts(self, domain):
"""Several shifts are siblings because they belong to the same
shfit template, the same day at the same our and for the same
task.
These represent the shift of all the poeple that will work
together.
This function aggregate shifts by task_template, start_time and
task_type for the given domain.
E.g. content of the list:
((task_template_id, start_time, task_type_id), shifts)
"""
all_shifts = self.env["shift.shift"].search(
domain,
# ensure shift are ordered for groupby
order="task_template_id, start_time, task_type_id",
)
all_shifts_groupby = itertools.groupby(
all_shifts,
lambda s: (s.task_template_id, s.start_time, s.task_type_id),
)
aggregated_shifts = []
for keys, grouped_shifts in all_shifts_groupby:
# Get back a shift recordset
shifts = self
for shift in grouped_shifts:
shifts |= shift
aggregated_shifts.append(
(
keys,
shifts,
)
)
return aggregated_shifts

# TODO button to replace someone
@api.model
def unsubscribe_from_today(
Expand Down
8 changes: 3 additions & 5 deletions shift_beneficiary/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ def get_selected_beneficiary(self):

def available_shift_irregular_worker(
self,
irregular_enable_sign_up=False,
nexturl="",
*args,
**kwargs,
):
res = super().available_shift_irregular_worker(
irregular_enable_sign_up, nexturl
)
res = super().available_shift_irregular_worker(*args, **kwargs)
beneficiary_list = (
request.env["res.partner"].sudo().search([("is_beneficiary", "=", True)])
)
Expand Down
69 changes: 69 additions & 0 deletions shift_change/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
============
Shift Change
============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3bc799017041fe0a23c0121f2311b7f7de77b1ed7d56d502433fc392b3edcfc2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-beescoop%2FObeesdoo-lightgray.png?logo=github
:target: https://github.com/beescoop/Obeesdoo/tree/16.0/shift_change
:alt: beescoop/Obeesdoo

|badge1| |badge2| |badge3|

Let regular worker change their future shifts.

Changing a shift means unsubscribe from a specific shift and register to
another one.

Change does not affect subscription to a shift template.

Changes can be done only between shifts already generated.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/beescoop/Obeesdoo/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 <https://github.com/beescoop/Obeesdoo/issues/new?body=module:%20shift_change%0Aversion:%2016.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>`_:

* Rémy Taymans

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

This module is part of the `beescoop/Obeesdoo <https://github.com/beescoop/Obeesdoo/tree/16.0/shift_change>`_ project on GitHub.

You are welcome to contribute.
6 changes: 6 additions & 0 deletions shift_change/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import models
from . import wizard
28 changes: 28 additions & 0 deletions shift_change/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

{
"name": "Shift Change",
"summary": """
Let regular workers change their shift.
""",
"author": "Coop IT Easy SC",
"website": "https://github.com/beescoop/Obeesdoo",
"category": "Cooperative Management",
"version": "16.0.1.0.0",
"depends": [
"shift",
],
"data": [
"data/system_parameter.xml",
"security/ir.model.access.csv",
"views/shift_change.xml",
"views/shift_change_menu.xml",
"views/res_config_setting_view.xml",
"views/res_partner.xml",
"wizard/shift_change_create_wizard.xml",
],
"demo": [],
"license": "AGPL-3",
}
20 changes: 20 additions & 0 deletions shift_change/data/system_parameter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
SPDX-FileCopyrightText: 2026 Coop IT Easy SC

SPDX-License-Identifier: AGPL-3.0-or-later
-->
<odoo noupdate="1">
<record id="old_shift_hour_limit_change" model="ir.config_parameter">
<field name="key">shift_change.old_shift_hour_limit_change</field>
<field name="value">24</field>
</record>
<record id="new_shift_hour_limit_change" model="ir.config_parameter">
<field name="key">shift_change.new_shift_hour_limit_change</field>
<field name="value">24</field>
</record>
<record id="same_shift_change_max" model="ir.config_parameter">
<field name="key">shift_change.same_shift_change_max</field>
<field name="value">3</field>
</record>
</odoo>
77 changes: 77 additions & 0 deletions shift_change/demo/demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
SPDX-FileCopyrightText: 2026 Coop IT Easy SC

SPDX-License-Identifier: AGPL-3.0-or-later
-->
<odoo>

<!-- Worker -->
<record id="shift.res_partner_worker_1_demo" model="res.partner">
<field
name="cooperative_status_ids"
eval="[(6, 0, [ref('shift.cooperative_status_1_demo')])]"
/>
</record>

<record id="shift.res_partner_worker_2_demo" model="res.partner">
<field
name="cooperative_status_ids"
eval="[(6, 0, [ref('shift.cooperative_status_2_demo')])]"
/>
</record>

<record id="shift.res_partner_worker_3_demo" model="res.partner">
<field
name="cooperative_status_ids"
eval="[(6, 0, [ref('shift.cooperative_status_3_demo')])]"
/>
</record>

<!-- Task Template -->
<record id="task_template_1_demo" model="shift.template">
<field name="name">A_TUE-10:00-12:00</field>
<field name="planning_id" ref="shift.shift_planning_1_demo" />
<field name="day_nb_id" ref="shift.shift_daynumber_2_demo" />
<field name="task_type_id" ref="shift.shift_task_type_3_demo" />
<field name="start_time">10.0</field>
<field name="end_time">12.0</field>
<field name="duration">2</field>
<field name="worker_nb">5</field>
<field name="worker_ids" eval="[(6, 0, [])]" />
<field name="remaining_worker">5</field>
</record>

<record id="task_template_2_demo" model="shift.template">
<field name="name">A_WED-10:00-12:00</field>
<field name="planning_id" ref="shift.shift_planning_1_demo" />
<field name="day_nb_id" ref="shift.shift_daynumber_3_demo" />
<field name="task_type_id" ref="shift.shift_task_type_3_demo" />
<field name="start_time">10.0</field>
<field name="end_time">12.0</field>
<field name="duration">2</field>
<field name="worker_nb">5</field>
<field
name="worker_ids"
eval="[(6, 0, [ref('shift.res_partner_worker_1_demo'), ref('shift.res_partner_worker_2_demo')])]"
/>
<field name="remaining_worker">4</field>
</record>

<record id="task_template_3_demo" model="shift.template">
<field name="name">A_THU-10:00-12:00</field>
<field name="planning_id" ref="shift.shift_planning_1_demo" />
<field name="day_nb_id" ref="shift.shift_daynumber_4_demo" />
<field name="task_type_id" ref="shift.shift_task_type_3_demo" />
<field name="start_time">10.0</field>
<field name="end_time">12.0</field>
<field name="duration">2</field>
<field name="worker_nb">1</field>
<field
name="worker_ids"
eval="[(6, 0, [ref('shift.res_partner_worker_1_demo')])]"
/>
<field name="remaining_worker">0</field>
</record>

</odoo>
7 changes: 7 additions & 0 deletions shift_change/migrations/16.0.1.0.0/post-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
# TODO:
pass
7 changes: 7 additions & 0 deletions shift_change/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import shift_change
from . import res_config_settings
from . import res_partner
19 changes: 19 additions & 0 deletions shift_change/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

old_shift_hour_limit_change = fields.Integer(
config_parameter="shift_change.hour_limit_change",
)
new_shift_hour_limit_change = fields.Integer(
config_parameter="shift_change.hour_limit_change",
)
same_shift_change_max = fields.Integer(
config_parameter="shift_change.same_shift_change_max",
)
19 changes: 19 additions & 0 deletions shift_change/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import _, models


class ResPartner(models.Model):
_inherit = "res.partner"

def button_change_shift(self):
return {
"name": _("Change a shift"),
"type": "ir.actions.act_window",
"view_type": "form",
"view_mode": "form",
"res_model": "shift.change.create.wizard",
"target": "new",
}
Loading
Loading