Contributors mailing list archives

Browse archives


Re: booking of resources

- 22/02/2023 11:39:49


thank you, pedro, olaf, and jairo, for your answers.

what we ended up doing is creating a module (resource_booking_auto_create) that adds a wizard that allows to select resources by category, and create resource combinations on the fly. it is available in oca/calendar#83. reviews welcome.

while this solution works, it feels to me like a big workaround. i realized too late into the development process (our budget on this was too limited) that a better solution would be to split the resource_booking module into multiple parts, because it handles too many independent things:

  • resource_booking would be the base module which defines the model and allows to book resources directly (m2m relationship to resource.resource) and handle the availability of resources.
  • resource_booking_type would depend on resource_booking and define the model.
  • resource_booking_combination would depend on resource_booking_type and define the model.

installing resource_booking_combination would result in the same behavior as is currently the case with resource_booking. in our case, we would depend only on resource_booking instead of creating useless combinations under the hood.

what do you think of this refactoring?

we also needed to be able to link a resource booking to a sale order. the sale_resource_booking module (which has not yet been migrated to 14.0) allows this but works in the opposite way of what we needed: it allows to schedule a booking from an existing sale order, while we wanted to create a sale order from a scheduled booking.

we ended up creating a new module resource_booking_sale that creates a sale order for each resource booking and displays (and allows to edit) the sale order lines directly on the resource booking form. it also allow to link a product to a resource booking type and to a resource and generates the sale order lines based on this. it is available here. what do you think? reviews welcome.

for the module containing the wizard, we had to define a resource.category model. we did it in another module (resource_category) (oca/calendar#83 adds several modules). it is a really simple addition (just a simple resource.category model with a name and m2m relationship between it and resource.resource), but i think that it should not belong in oca/calendar. i think that we are missing an oca/resource repository for modules handling resources.

what do you think?


coop it easy