diff --git a/hotel_management_odoo/__manifest__.py b/hotel_management_odoo/__manifest__.py index 594cb2975..ac3599eea 100644 --- a/hotel_management_odoo/__manifest__.py +++ b/hotel_management_odoo/__manifest__.py @@ -21,9 +21,9 @@ ############################################################################### { 'name': 'Odoo17 Hotel Management', - 'version': '17.0.1.0.0', + 'version': '17.0.1.0.1', 'category': 'Industries', - 'summary': """Hotel Management, Odoo Hotel Management, Hotel, Room Booking odoo, Amenities Odoo, Event management""" , + 'summary': """Hotel Management, Odoo Hotel Management, Hotel, Room Booking odoo, Amenities Odoo, Event management""", 'description': """The module helps you to manage rooms, amenities, services, food, events and vehicles. End Users can book rooms and reserve foods from hotel.""", diff --git a/hotel_management_odoo/doc/RELEASE_NOTES.md b/hotel_management_odoo/doc/RELEASE_NOTES.md index 094620355..ae43252dd 100644 --- a/hotel_management_odoo/doc/RELEASE_NOTES.md +++ b/hotel_management_odoo/doc/RELEASE_NOTES.md @@ -4,3 +4,8 @@ #### Version 17.0.1.0.0 #### ADD - Initial commit for Hotel Management + +#### 29.03.2024 +#### Version 17.0.1.0.1 +#### UPDATE + - Add a validation for timezone in dashboard. \ No newline at end of file diff --git a/hotel_management_odoo/models/room_booking.py b/hotel_management_odoo/models/room_booking.py index 529aa9e44..2577c896e 100644 --- a/hotel_management_odoo/models/room_booking.py +++ b/hotel_management_odoo/models/room_booking.py @@ -650,89 +650,94 @@ class RoomBooking(models.Model): def get_details(self): """ Returns different counts for displaying in dashboard""" today = datetime.today() - tz_name = self.env.user.tz + tz_name = False + if self.env.user.tz: + tz_name = self.env.user.tz today_utc = pytz.timezone('UTC').localize(today, is_dst=False) - context_today = today_utc.astimezone(pytz.timezone(tz_name)) - total_room = self.env['hotel.room'].search_count([]) - check_in = self.env['room.booking'].search_count( - [('state', '=', 'check_in')]) - available_room = self.env['hotel.room'].search( - [('status', '=', 'available')]) - reservation = self.env['room.booking'].search_count( - [('state', '=', 'reserved')]) - check_outs = self.env['room.booking'].search([]) - check_out = 0 - staff = 0 - for rec in check_outs: - for room in rec.room_line_ids: - if room.checkout_date.date() == context_today.date(): - check_out += 1 - """staff""" - staff = self.env['res.users'].search_count( - [('groups_id', 'in', - [self.env.ref('hotel_management_odoo.hotel_group_admin').id, - self.env.ref( - 'hotel_management_odoo.cleaning_team_group_head').id, - self.env.ref( - 'hotel_management_odoo.cleaning_team_group_user').id, - self.env.ref( - 'hotel_management_odoo.hotel_group_reception').id, - self.env.ref( - 'hotel_management_odoo.maintenance_team_group_leader').id, - self.env.ref( - 'hotel_management_odoo.maintenance_team_group_user').id - ])]) - total_vehicle = self.env['fleet.vehicle.model'].search_count([]) - available_vehicle = total_vehicle - self.env[ - 'fleet.booking.line'].search_count( - [('state', '=', 'check_in')]) - total_event = self.env['event.event'].search_count([]) - pending_event = self.env['event.event'].search([]) - pending_events = 0 - today_events = 0 - for pending in pending_event: - if pending.date_end >= fields.datetime.now(): - pending_events += 1 - if pending.date_end.date() == fields.date.today(): - today_events += 1 - food_items = self.env['lunch.product'].search_count([]) - food_order = len(self.env['food.booking.line'].search([]).filtered( - lambda r: r.booking_id.state not in ['check_out', 'cancel', - 'done'])) - """total Revenue""" - total_revenue = 0 - today_revenue = 0 - pending_payment = 0 - for rec in self.env['account.move'].search( - [('payment_state', '=', 'paid')]): - if rec.ref: - if 'BOOKING' in rec.ref: - total_revenue += rec.amount_total - if rec.date == fields.date.today(): - today_revenue += rec.amount_total - for rec in self.env['account.move'].search( - [('payment_state', '=', 'not_paid')]): - if rec.ref: - if 'BOOKING' in rec.ref: - pending_payment += rec.amount_total - return { - 'total_room': total_room, - 'available_room': len(available_room), - 'staff': staff, - 'check_in': check_in, - 'reservation': reservation, - 'check_out': check_out, - 'total_vehicle': total_vehicle, - 'available_vehicle': available_vehicle, - 'total_event': total_event, - 'today_events': today_events, - 'pending_events': pending_events, - 'food_items': food_items, - 'food_order': food_order, - 'total_revenue': round(total_revenue, 2), - 'today_revenue': round(today_revenue, 2), - 'pending_payment': round(pending_payment, 2), - 'currency_symbol': self.env.user.company_id.currency_id.symbol, - 'currency_position': self.env.user.company_id.currency_id.position - } + if tz_name: + context_today = today_utc.astimezone(pytz.timezone(tz_name)) + total_room = self.env['hotel.room'].search_count([]) + check_in = self.env['room.booking'].search_count( + [('state', '=', 'check_in')]) + available_room = self.env['hotel.room'].search( + [('status', '=', 'available')]) + reservation = self.env['room.booking'].search_count( + [('state', '=', 'reserved')]) + check_outs = self.env['room.booking'].search([]) + check_out = 0 + staff = 0 + for rec in check_outs: + for room in rec.room_line_ids: + if room.checkout_date.date() == context_today.date(): + check_out += 1 + """staff""" + staff = self.env['res.users'].search_count( + [('groups_id', 'in', + [self.env.ref('hotel_management_odoo.hotel_group_admin').id, + self.env.ref( + 'hotel_management_odoo.cleaning_team_group_head').id, + self.env.ref( + 'hotel_management_odoo.cleaning_team_group_user').id, + self.env.ref( + 'hotel_management_odoo.hotel_group_reception').id, + self.env.ref( + 'hotel_management_odoo.maintenance_team_group_leader').id, + self.env.ref( + 'hotel_management_odoo.maintenance_team_group_user').id + ])]) + total_vehicle = self.env['fleet.vehicle.model'].search_count([]) + available_vehicle = total_vehicle - self.env[ + 'fleet.booking.line'].search_count( + [('state', '=', 'check_in')]) + total_event = self.env['event.event'].search_count([]) + pending_event = self.env['event.event'].search([]) + pending_events = 0 + today_events = 0 + for pending in pending_event: + if pending.date_end >= fields.datetime.now(): + pending_events += 1 + if pending.date_end.date() == fields.date.today(): + today_events += 1 + food_items = self.env['lunch.product'].search_count([]) + food_order = len(self.env['food.booking.line'].search([]).filtered( + lambda r: r.booking_id.state not in ['check_out', 'cancel', + 'done'])) + """total Revenue""" + total_revenue = 0 + today_revenue = 0 + pending_payment = 0 + for rec in self.env['account.move'].search( + [('payment_state', '=', 'paid')]): + if rec.ref: + if 'BOOKING' in rec.ref: + total_revenue += rec.amount_total + if rec.date == fields.date.today(): + today_revenue += rec.amount_total + for rec in self.env['account.move'].search( + [('payment_state', '=', 'not_paid')]): + if rec.ref: + if 'BOOKING' in rec.ref: + pending_payment += rec.amount_total + return { + 'total_room': total_room, + 'available_room': len(available_room), + 'staff': staff, + 'check_in': check_in, + 'reservation': reservation, + 'check_out': check_out, + 'total_vehicle': total_vehicle, + 'available_vehicle': available_vehicle, + 'total_event': total_event, + 'today_events': today_events, + 'pending_events': pending_events, + 'food_items': food_items, + 'food_order': food_order, + 'total_revenue': round(total_revenue, 2), + 'today_revenue': round(today_revenue, 2), + 'pending_payment': round(pending_payment, 2), + 'currency_symbol': self.env.user.company_id.currency_id.symbol, + 'currency_position': self.env.user.company_id.currency_id.position + } + else: + raise ValidationError(_("Please Enter time zone in user settings.")) diff --git a/hotel_management_odoo/static/src/css/dashboard.css b/hotel_management_odoo/static/src/css/dashboard.css index 2f3663c2a..23861c35f 100644 --- a/hotel_management_odoo/static/src/css/dashboard.css +++ b/hotel_management_odoo/static/src/css/dashboard.css @@ -5,6 +5,8 @@ } .oh_dashboards { padding: 0px !important; + overflow: auto; + height: 100%; } .dash-card .card{ text-align:center; diff --git a/hotel_management_odoo/static/src/js/dashboard_action.js b/hotel_management_odoo/static/src/js/dashboard_action.js index 98454b338..0cae3a33c 100644 --- a/hotel_management_odoo/static/src/js/dashboard_action.js +++ b/hotel_management_odoo/static/src/js/dashboard_action.js @@ -33,6 +33,7 @@ async onMounted() { } fetch_data() { var self = this; + console.log("dafdaafdfadf", this) //RPC call for retrieving data for displaying on dashboard tiles var def1= jsonrpc('/web/dataset/call_kw/room.booking/get_details' ,{ model:'room.booking',