diff --git a/table_reservation_on_website/__manifest__.py b/table_reservation_on_website/__manifest__.py
index 08800ea37..5a6268cc3 100644
--- a/table_reservation_on_website/__manifest__.py
+++ b/table_reservation_on_website/__manifest__.py
@@ -21,7 +21,7 @@
###############################################################################
{
'name': 'Table Reservation on Website',
- 'version': '15.0.1.0.0',
+ 'version': '15.0.1.1.0',
'category': 'eCommerce,Point of Sale',
'summary': 'We can reserve table through website',
'description': 'We can reserve table through website. And also user can '
@@ -53,6 +53,7 @@
'web.assets_frontend': [
'table_reservation_on_website/static/src/js/table_reservation.js',
'table_reservation_on_website/static/src/js/reservation_floor.js',
+ 'table_reservation_on_website/static/src/js/reservation.js',
],
},
'images': ['static/description/banner.png'],
diff --git a/table_reservation_on_website/controllers/__init__.py b/table_reservation_on_website/controllers/__init__.py
index 4b23b6364..b8593b16c 100644
--- a/table_reservation_on_website/controllers/__init__.py
+++ b/table_reservation_on_website/controllers/__init__.py
@@ -20,4 +20,5 @@
#
###############################################################################
from . import main
-from . import table_reservation_on_website
+from . import table_reservation
+from . import pos_config
diff --git a/table_reservation_on_website/controllers/pos_config.py b/table_reservation_on_website/controllers/pos_config.py
new file mode 100644
index 000000000..b57f697fb
--- /dev/null
+++ b/table_reservation_on_website/controllers/pos_config.py
@@ -0,0 +1,29 @@
+from odoo import http
+from odoo.http import request
+
+
+class ResConfigSettingsController(http.Controller):
+
+ @http.route('/pos/get_opening_closing_hours', type='json', auth='public', methods=['POST'])
+ def get_opening_closing_hours(self):
+ pos_config = request.env['pos.config'].sudo().search([], limit=1, order="id desc")
+ # Ensure proper time format
+ try:
+ opening_hour = self.float_to_time(float(pos_config.opening_hour))
+ closing_hour = self.float_to_time(float(pos_config.closing_hour))
+ except ValueError:
+ opening_hour = "00:00"
+ closing_hour = "23:59"
+
+ if pos_config:
+ return {
+ 'opening_hour': opening_hour,
+ 'closing_hour': closing_hour
+ }
+ return {'error': 'POS configuration not found'}
+
+ def float_to_time(self, hour_float):
+ """ Convert float hours (e.g., 8.5 → 08:30) to HH:MM format """
+ hours = int(hour_float)
+ minutes = int((hour_float - hours) * 60)
+ return f"{hours:02d}:{minutes:02d}"
diff --git a/table_reservation_on_website/controllers/table_reservation_on_website.py b/table_reservation_on_website/controllers/table_reservation.py
similarity index 91%
rename from table_reservation_on_website/controllers/table_reservation_on_website.py
rename to table_reservation_on_website/controllers/table_reservation.py
index bc064dbbd..54d0ed08b 100644
--- a/table_reservation_on_website/controllers/table_reservation_on_website.py
+++ b/table_reservation_on_website/controllers/table_reservation.py
@@ -30,8 +30,27 @@ class TableReservation(http.Controller):
@http.route(['/table_reservation'], type='http', auth='user', website=True)
def table_reservation(self):
"""For render table reservation template"""
+ pos_config = request.env['pos.config'].sudo().search([],limit=1,
+ order="id desc")
+ try:
+ opening_hour = self.float_to_time(
+ float(pos_config.opening_hour))
+ closing_hour = self.float_to_time(
+ float(pos_config.closing_hour))
+ except ValueError:
+ opening_hour = "00:00"
+ closing_hour = "23:59"
return http.request.render(
- "table_reservation_on_website.table_reservation", {})
+ "table_reservation_on_website.table_reservation",
+ {'opening_hour': opening_hour,
+ 'closing_hour': closing_hour})
+
+ def float_to_time(self, hour_float):
+ """ Convert float hours (e.g., 8.5 → 08:30) to HH:MM format """
+ hours = int(hour_float)
+ minutes = int((hour_float - hours) * 60)
+ return f"{hours:02d}:{minutes:02d}"
+
@http.route(['/restaurant/floors'], type='http', auth='user', website=True)
def restaurant_floors(self, **kwargs):
@@ -54,7 +73,7 @@ class TableReservation(http.Controller):
"table_reservation_on_website.restaurant_floors", vals)
@http.route(['/restaurant/floors/tables'], type='json', auth='user',
- website=True)
+ website=True )
def restaurant_floors_tables(self, **kwargs):
"""To get non-reserved table details"""
table_inbetween = []
@@ -93,8 +112,8 @@ class TableReservation(http.Controller):
data_tables[rec.id]['rate'] = 0
return data_tables
- @http.route(['/booking/confirm'], type="http", auth="public",
- csrf=False, website=True)
+ @http.route(['/booking/confirm'], type="http", auth="public", methods=['POST'], website=True
+ )
def booking_confirm(self, **kwargs):
"""For booking tables"""
company = request.env.company
diff --git a/table_reservation_on_website/doc/RELEASE_NOTES.md b/table_reservation_on_website/doc/RELEASE_NOTES.md
index c61545b9a..b9314240c 100644
--- a/table_reservation_on_website/doc/RELEASE_NOTES.md
+++ b/table_reservation_on_website/doc/RELEASE_NOTES.md
@@ -5,3 +5,9 @@
#### ADD
- Initial commit for Table Reservation on Website
+
+#### 01.04.2025
+#### Version 15.0.1.1.0
+#### UPDATE
+
+- Updated module to set opening and closing hours.
diff --git a/table_reservation_on_website/models/pos_config.py b/table_reservation_on_website/models/pos_config.py
index 248d81e04..4914ab645 100644
--- a/table_reservation_on_website/models/pos_config.py
+++ b/table_reservation_on_website/models/pos_config.py
@@ -35,3 +35,15 @@ class PosConfig(models.Model):
refund = fields.Text(string="No Refund Notes", help="No refund notes to "
"display in website",
config_parameter="table_reservation_on_website.refund")
+ set_opening_hours = fields.Boolean(string="Set Opening Hours",
+ help="Enable to configure restaurant opening and closing hours.",
+ config_parameter="table_"
+ "reservation_on_"
+ "website.reservation"
+ "set_opening_hours")
+ opening_hour = fields.Float(string="Opening Hours",
+ help="Restaurant opening hour in 24-hour format."
+ )
+ closing_hour = fields.Float(string="Closing Hours",
+ help="Restaurant closing hour in 24-hour format."
+ )
diff --git a/table_reservation_on_website/static/description/assets/screenshots/19.png b/table_reservation_on_website/static/description/assets/screenshots/19.png
new file mode 100644
index 000000000..8b6103c47
Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/19.png differ
diff --git a/table_reservation_on_website/static/description/assets/screenshots/4.png b/table_reservation_on_website/static/description/assets/screenshots/4.png
index d6433d65c..70ba50406 100644
Binary files a/table_reservation_on_website/static/description/assets/screenshots/4.png and b/table_reservation_on_website/static/description/assets/screenshots/4.png differ
diff --git a/table_reservation_on_website/static/description/index.html b/table_reservation_on_website/static/description/index.html
index a3c268fef..6be0ba2a5 100644
--- a/table_reservation_on_website/static/description/index.html
+++ b/table_reservation_on_website/static/description/index.html
@@ -175,7 +175,10 @@
-
+