Browse Source

Oct 14: [FIX] Bug Fixed 'hotel_management_odoo'

pull/347/head
Cybrosys Technologies 7 months ago
parent
commit
da284ac91b
  1. 2
      hotel_management_odoo/__manifest__.py
  2. 7
      hotel_management_odoo/doc/RELEASE_NOTES.md
  3. 5
      hotel_management_odoo/models/room_booking_line.py
  4. 2
      hotel_management_odoo/report/room_booking_reports.xml
  5. 2
      hotel_management_odoo/views/room_booking_views.xml
  6. 19
      hotel_management_odoo/wizard/room_booking_detail.py

2
hotel_management_odoo/__manifest__.py

@ -21,7 +21,7 @@
###############################################################################
{
'name': 'Odoo17 Hotel Management',
'version': '17.0.1.2.5',
'version': '17.0.1.2.4',
'category': 'Services',
'summary': """Hotel Management, Odoo Hotel Management, Hotel, Room Booking odoo, Amenities Odoo, Event management, Rooms, Events, Food, Booking, Odoo Hotel, Odoo17, Odoo Apps""",
'description': """The module helps you to manage rooms, amenities,

7
hotel_management_odoo/doc/RELEASE_NOTES.md

@ -20,8 +20,7 @@
#### UPDATE
- Updated the workflow maintenance request and cleaning request model(removed a field from each)
#### 04.09.2024
#### Version 17.0.1.2.5
#### 14.10.2024
#### Version 17.0.1.2.4
#### UPDATE
- Updated the workflow in room booking line since a validation error doesnot allows booking after reserved days and
also in room booking report since the checkin date and checkout date was not correct
- Updated the invisible condition of 'create invoice' button in room booking model

5
hotel_management_odoo/models/room_booking_line.py

@ -150,13 +150,14 @@ class RoomBookingLine(models.Model):
rec_room_id = rec.room_line_ids.room_id
rec_checkin_date = rec.room_line_ids.checkin_date
rec_checkout_date = rec.room_line_ids.checkout_date
if rec_room_id and rec_checkin_date and rec_checkout_date:
# Check for conflicts with existing room lines
for line in self:
if line.id != rec.id and line.room_id == rec_room_id:
# Check if the dates overlap
if (rec_checkin_date >= line.checkin_date >= rec_checkout_date or
rec_checkin_date >= line.checkout_date >= rec_checkout_date):
if (rec_checkin_date <= line.checkin_date <= rec_checkout_date or
rec_checkin_date <= line.checkout_date <= rec_checkout_date):
raise ValidationError(
_("Sorry, You cannot create a reservation for "
"this date since it overlaps with another "

2
hotel_management_odoo/report/room_booking_reports.xml

@ -45,7 +45,7 @@
<t t-esc="line['checkin_date']"/>
</td>
<td>
<t t-esc="line['checkout_date']"/>
<t t-esc="line['checkin_date']"/>
</td>
<td>
<t t-esc="line['name']"/>

2
hotel_management_odoo/views/room_booking_views.xml

@ -26,7 +26,7 @@
invisible="state != 'check_out'" type="object"/>
<button name="action_invoice" string="Create Invoice"
type="object" class="btn-primary"
invisible="state not in ('draft', 'done') or invoice_button_visible == True"/>
invisible="state == 'draft' or invoice_button_visible == True"/>
<button name="action_cancel" string="Cancel"
invisible="state not in ('draft','reserved','check_out')" type="object" class="btn-secondary"/>
<field name="state" select="2" widget="statusbar"

19
hotel_management_odoo/wizard/room_booking_detail.py

@ -86,22 +86,25 @@ class RoomBookingWizard(models.TransientModel):
)
room_booking = self.env["room.booking"].search_read(
domain=domain,
fields=["partner_id", "name"],
fields=["partner_id", "name", "checkin_date", "checkout_date"],
)
for rec in room_booking:
rooms = self.env["room.booking"].browse(rec["id"])
rooms = (
self.env["room.booking"]
.browse(rec["id"])
.room_line_ids.room_id.mapped("name")
)
rec["partner_id"] = rec["partner_id"][1]
for line in rooms.room_line_ids:
for room in rooms:
if self.room_id:
if self.room_id.id == line.room_id.id:
rec["room_id"] = line.room_id.name
rec["checkin_date"] = line.checkin_date.date()
rec["checkout_date"] = line.checkout_date.date()
if self.room_id.name == room:
rec["room_id"] = room
room_list.append(rec)
else:
rec_copy = rec.copy()
rec_copy["room_id"] = line.room_id.name
rec_copy["room_id"] = room
room_list.append(rec_copy)
return room_list
def get_xlsx_report(self, data, response):

Loading…
Cancel
Save