Skip to Content
Menu
This question has been flagged
3 Replies
6032 Views

Hello!

Im pretty newbie on this but im trying to learn and expand my knowledge.

I have a hotel which has a booking system, this booking system takes from user 2 dates , booking start and booking end. I would like to check when a new user tries to make a new booking if his date inserted is not overlaping another booking, do you copy me?


I think is by using the constrains odoo gives but how i can compare dates? For example if user a introduces that he wants a booking from 02/09/2018 to 04/09/2018 and user b tries to make a book for 03/09/2018 it should tell him that it is not possible. But how? I thought on parsing the result to EPOCH/posix time but i also dont know how to do it, im also a newbie on python.


Someone can help me?  

Avatar
Discard

this is not a question related to odoo. you should first look into data structures and learn them. then go ahead and learn little bit of python date: https://docs.python.org/3.4/library/datetime.html

Best Answer

Hello @Tihomir,

You can use following filter domain for remove overlap bookings for your hotel.

domain = [('start_date', '<=', self.booking_upto),('end_date', '>=', self.booking_from)]
booking = self.env['hotal.booking'].search(domain)

where booking_upto and booking_from date fields from 'hotel.booking'. And start_date & end_date field model from where you booking.

Also you can check this principle in HR Management.

Hopefully this will helpful for you.

Avatar
Discard
Best Answer

Buen día.

Yo comenzaría por hacer la prueba con el módulo de citas https://www.youtube.com/watch?v=nSnc5W5cuwQ, registrando cada habitación como un recurso.

1. Registrar un recurso por tipo de habitación que tienes en tu hotel.

2. Crear los horarios disponibles, poniendo el tiempo en base a la cantidad de habitaciones disponibles, para que puedan reservar en un día sólo la cantidad de habitaciones de ese tipo que se tienen disponibles, Internamente la hora de la habitación para llevar el control la podrían tomar como la habitación, ejemplo: reserva de la habitación 11 h 00, sería la habitación 211.

3. Hacer un pequeño ajuste en la página para que muestre el día de reserva en lugar de la hora.

Puedes descargar completamente gratis y con usuarios ilimitados, la aplicación de página WEB y citas, agregando módulos gratuitos como blogs, chat en linea, presentaciones, flotillas etc... en el siguiente link:  https://www.odoo.com/es_ES/page/appointments

Espero la idea le sea de ayuda. Saludos!

Avatar
Discard
Related Posts Replies Views Activity
1
Feb 18
2297
1
Feb 16
2508
1
Mar 15
3160
1
Nov 23
1112
2
May 23
5647