Skip to content

Commit 15a6db1

Browse files
committed
draft new function to uncancel shifts in volunteer_company_holiday (for now commented).
1 parent 8488f36 commit 15a6db1

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

volunteer_holiday/models/volunteer_company_holiday.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,33 @@ def _shift_covers_holiday(
109109
and shift_end_date >= holiday_end_date
110110
)
111111
)
112+
113+
# Override Methods
114+
115+
# def write(self, vals):
116+
# self.ensure_one()
117+
# if "start_date" in vals or "end_date" in vals:
118+
# old_start_date = self.start_date
119+
# old_end_date = self.end_date
120+
121+
# if vals["start_date"] > old_start_date:
122+
# shifts_to_uncancel = self.env["volunteer_shift"].sudo().search(
123+
# [
124+
# ("shift.state", "=", "canceled"),
125+
# ("shift.start_time", ">", old_start_date),
126+
# ("shift.start_time", "<", vals["start_date"]),
127+
# ("shift.generator_id", "!=", None),
128+
# ("shift.generator_id.is_maintained_during_holiday", "=", False),
129+
# # Ajouter un bool canceled_through_cron ?
130+
# ]
131+
# )
132+
# for shift in shifts_to_uncancel:
133+
# shift.super().write(
134+
# {
135+
# "stage_id": self.env.ref(
136+
# "volunteer.volunteer_shift_stage_confirmed"
137+
# ).id
138+
# }
139+
# )
140+
141+
# # if vals["end_date"] < old_end_date:

0 commit comments

Comments
 (0)