mirror of
https://github.com/bringout/oca-ocb-technical.git
synced 2026-04-21 22:52:06 +02:00
19.0 vanilla
This commit is contained in:
parent
5faf7397c5
commit
2696f14ed7
721 changed files with 220375 additions and 91221 deletions
11
odoo-bringout-oca-ocb-calendar/calendar/models/utils.py
Normal file
11
odoo-bringout-oca-ocb-calendar/calendar/models/utils.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from odoo.tools.intervals import Intervals
|
||||
|
||||
|
||||
def interval_from_events(event_ids):
|
||||
"""Group events with contiguous and/or overlapping time slots.
|
||||
|
||||
Can be used to avoid doing time-related querries on long stretches of time with no relevant event.
|
||||
:param <calendar.event> event_ids: Any recordset of events
|
||||
:return Intervals|Iterable[tuple[datetime, datetime, <calendar.event>]]:
|
||||
"""
|
||||
return Intervals([(event.start, event.stop, event) for event in event_ids if event.start and event.stop])
|
||||
Loading…
Add table
Add a link
Reference in a new issue