reservation.models.resource
Attributes
Classes
A resource holds a single calendar with allocations and reservations. |
Functions
|
Module Contents
- class reservation.models.resource.Resource[source]
Bases:
libres.db.models.base.ORMBase,onegov.core.orm.ModelBase,onegov.core.orm.mixins.ContentMixin,onegov.core.orm.mixins.TimestampMixin,onegov.file.MultiAssociatedFilesA resource holds a single calendar with allocations and reservations.
Note that this resource is not defined on the onegov.core declarative base. Instead it is defined using the libres base. This means we can’t join data outside the libres models.
This should however not be a problem as this onegov module is self contained and does not link to other onegov modules, except for core.
If we ever want to link to other models (say link a reservation to a user), then we have to switch to a unified base. Ideally we would find a way to merge these bases somehow.
Also note that we do use the ModelBase class as a mixin to at least share the same methods as all the usual onegov.core.orm models.
- payment_method: onegov.core.orm.mixins.dict_property[onegov.pay.types.PaymentMethod | None][source]
- _allocations: sqlalchemy.orm.Mapped[list[libres.db.models.Allocation]][source]
- _virtual_allocations: sqlalchemy.orm.Mapped[list[libres.db.models.Allocation]][source]
- virtual_id() uuid.UUID[source]
The resource’s secondary virtual id.
The virtual resource can be used as a second layer with its own allocations that can overlap allocations on the first layer while reservations on these two layers properly block one another.
We generally use this to provide an internal unrestricted layer where partly-available full-day allocations get created on-demand to fit any reservations
- highlight_allocations(allocations: collections.abc.Sequence[libres.db.models.Allocation]) None[source]
The allocation to jump to in the view.
- blocking_resource_ids(libres_context: libres.context.core.Context | None = None) set[uuid.UUID][source]
Returns a set of blocking resource ids.
This excludes virtual resource ids, which will also act as blocking entities when creating reservations.
- get_scheduler(libres_context: libres.context.core.Context, *, virtual: bool = False) _OurScheduler[source]
- bind_to_libres_context(libres_context: libres.context.core.Context) None[source]
- property form_class: type[onegov.form.Form] | None[source]
Parses the form definition and returns a form class.
- invoice_items_for_reservation(reservations: collections.abc.Sequence[onegov.reservation.models.CustomReservation], extras: collections.abc.Sequence[onegov.pay.InvoiceItemMeta] | None = None, discounts: collections.abc.Sequence[onegov.pay.InvoiceDiscountMeta] | None = None, submission_data: dict[str, Any] | None = None, *, reduced_amount_label: str) list[onegov.pay.InvoiceItemMeta][source]
- store_pricing_settings(data: dict[str, Any], allocation: libres.db.models.Allocation | None) None[source]
Stores the resource/allocation specific pricing settings on the given reservation data, so pricing on that reservation remains stable, regardless of what changes later happen to the resource/allocation.