diff --git a/table_reservation_on_website/README.rst b/table_reservation_on_website/README.rst new file mode 100644 index 000000000..9d856c3b3 --- /dev/null +++ b/table_reservation_on_website/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Table Reservation on Website +============================ +This module allows to reserve tables in POS from website. + +Configuration +============= +* No additional configurations needed.z + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Lesser General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +* Developers : (V16) Fathima Mazlin AM, + (V17) Aysha Shalin + Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/table_reservation_on_website/__init__.py b/table_reservation_on_website/__init__.py new file mode 100644 index 000000000..b80a27367 --- /dev/null +++ b/table_reservation_on_website/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import controllers +from . import models diff --git a/table_reservation_on_website/__manifest__.py b/table_reservation_on_website/__manifest__.py new file mode 100644 index 000000000..d5f557835 --- /dev/null +++ b/table_reservation_on_website/__manifest__.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +{ + 'name': 'Table Reservation on Website', + 'version': '17.0.1.0.0', + 'category': 'eCommerce,Point of Sale', + 'summary': 'Reserve tables in POS from website', + 'description': """This module enables to reserve tables in POS from website. + User will be able to select the floor, table, date and time.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'website_sale', 'pos_restaurant'], + 'data': [ + 'security/ir.model.access.csv', + 'data/table_reservation_data.xml', + 'data/product_product_data.xml', + 'views/table_reservation_templates.xml', + 'views/table_reservation_on_website_menus.xml', + 'views/restaurant_table_views.xml', + 'views/restaurant_floor_views.xml', + 'views/table_reservation_views.xml', + 'views/sale_order_views.xml', + 'views/table_reserved_templates.xml', + 'views/res_config_settings_views.xml', + ], + 'assets': { + 'point_of_sale._assets_pos': [ + 'table_reservation_on_website/static/src/js/PaymentScreen.js', + 'table_reservation_on_website/static/src/js/FloorScreen.js', + 'table_reservation_on_website/static/src/xml/FloorScreen.xml', + 'table_reservation_on_website/static/src/scss/style.css', + ], + 'web.assets_frontend': [ + 'table_reservation_on_website/static/src/js/table_reservation.js', + 'table_reservation_on_website/static/src/js/reservation_floor.js', + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/table_reservation_on_website/controllers/__init__.py b/table_reservation_on_website/controllers/__init__.py new file mode 100644 index 000000000..8a870456e --- /dev/null +++ b/table_reservation_on_website/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import main +from . import table_reservation_on_website diff --git a/table_reservation_on_website/controllers/main.py b/table_reservation_on_website/controllers/main.py new file mode 100644 index 000000000..fefa378c0 --- /dev/null +++ b/table_reservation_on_website/controllers/main.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import http +from odoo.exceptions import ValidationError +from odoo.http import request +from odoo.addons.website_sale.controllers.main import WebsiteSale +from odoo import SUPERUSER_ID + + +class WebsiteSalePayment(WebsiteSale): + """ For creating new record for table reservation """ + @http.route('/shop/payment/validate', type='http', auth="public", + website=True, sitemap=False) + def shop_payment_validate(self, sale_order_id=None, **post): + """ Payment Validate page """ + if sale_order_id is None: + order = request.website.sale_get_order() + if not order and 'sale_last_order_id' in request.session: + last_order_id = request.session['sale_last_order_id'] + order = request.env['sale.order'].sudo().browse( + last_order_id).exists() + else: + order = request.env['sale.order'].sudo().browse(sale_order_id) + assert order.id == request.session.get('sale_last_order_id') + errors = self._get_shop_payment_errors(order) + if errors: + first_error = errors[0] # only display first error + error_msg = f"{first_error[0]}\n{first_error[1]}" + raise ValidationError(error_msg) + tx_sudo = order.get_portal_last_transaction() if order else order.env['payment.transaction'] + if order: + reservation = request.env['table.reservation'].sudo().create({ + "customer_id": request.env.user.partner_id.id, + "booked_tables_ids": order.tables_ids, + "floor_id": order.floors, + "date": order.date, + "starting_at": order.starting_at, + "ending_at": order.ending_at, + 'booking_amount': order.booking_amount, + 'state': 'reserved', + }) + order.table_reservation_id = reservation.id + if not order or (order.amount_total and not tx_sudo): + return request.redirect('/shop') + if order and not order.amount_total and not tx_sudo: + order.with_context(send_email=True).with_user(SUPERUSER_ID).action_confirm() + return request.redirect(order.get_portal_url()) + request.website.sale_reset() + if tx_sudo and tx_sudo.state == 'draft': + return request.redirect('/shop') + return request.redirect('/shop/confirmation') diff --git a/table_reservation_on_website/controllers/table_reservation_on_website.py b/table_reservation_on_website/controllers/table_reservation_on_website.py new file mode 100644 index 000000000..a58cc15c4 --- /dev/null +++ b/table_reservation_on_website/controllers/table_reservation_on_website.py @@ -0,0 +1,206 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from datetime import datetime, timedelta +from odoo import http +from odoo.http import request + + +class TableReservation(http.Controller): + """ For reservation of tables """ + @http.route(['/table_reservation'], type='http', auth='user', website=True) + def table_reservation(self): + """ For rendering table reservation template """ + return http.request.render( + "table_reservation_on_website.table_reservation", {}) + + @http.route(['/restaurant/floors'], type='http', auth='user', website=True) + def restaurant_floors(self, **kwargs): + """ To get floor details """ + floors = request.env['restaurant.floor'].search([]) + payment = request.env['ir.config_parameter'].sudo().get_param( + "table_reservation_on_website.reservation_charge") + refund = request.env['ir.config_parameter'].sudo().get_param( + 'table_reservation_on_website.refund') + vals = { + 'floors': floors, + 'date': kwargs.get('date'), + 'start_time': kwargs.get('start_time'), + 'end_time': kwargs.get('end_time'), + 'payment': payment, + 'refund': refund, + } + return http.request.render( + "table_reservation_on_website.restaurant_floors", vals) + + @http.route(['/restaurant/floors/tables'], type='json', auth='user', + website=True) + def restaurant_floors_tables(self, **kwargs): + """ To get non-reserved table details """ + table_inbetween = [] + payment = request.env['ir.config_parameter'].sudo().get_param( + "table_reservation_on_website.reservation_charge") + tables = request.env['restaurant.table'].search( + [('floor_id', '=', int(kwargs.get('floors_id')))]) + reserved = request.env['table.reservation'].search( + [('floor_id', '=', int(kwargs.get('floors_id'))), ( + 'date', '=', datetime.strptime(kwargs.get('date'), + "%Y-%m-%d")), ( + 'state', '=', 'reserved')]) + start_time_new = datetime.strptime(kwargs.get("start").strip(), "%H:%M").time() + for rec in reserved: + start_at = datetime.strptime(rec.starting_at, "%H:%M").time() + end_at = datetime.strptime(rec.ending_at, "%H:%M").time() + if start_at <= start_time_new <= end_at: + for table in rec.booked_tables_ids: + table_inbetween.append(table.id) + data_tables = {} + for rec in tables: + if rec.id not in table_inbetween: + if payment: + data_tables[rec.id] = {} + data_tables[rec.id]['id'] = rec.id + data_tables[rec.id]['name'] = rec.name + data_tables[rec.id]['seats'] = rec.seats + data_tables[rec.id]['rate'] = rec.rate + else: + data_tables[rec.id] = {} + data_tables[rec.id]['id'] = rec.id + data_tables[rec.id]['name'] = rec.name + data_tables[rec.id]['seats'] = rec.seats + data_tables[rec.id]['rate'] = 0 + return data_tables + + @http.route(['/booking/confirm'], type="http", auth="public", + csrf=False, website=True) + def booking_confirm(self, **kwargs): + """ For booking tables """ + company = request.env.company + list_tables = [rec for rec in kwargs.get("tables").split(',')] + record_tables = request.env['restaurant.table'].search( + [('id', 'in', list_tables)]) + amount = [rec.rate for rec in record_tables] + payment = request.env['ir.config_parameter'].sudo().get_param( + "table_reservation_on_website.reservation_charge") + if payment: + table = request.env.ref( + 'table_reservation_on_website' + '.product_product_table_booking') + table.write({ + 'list_price': sum(amount) + }) + sale_order = request.website.sale_get_order(force_create=True) + if sale_order.state != 'draft': + request.session['sale_order_id'] = None + sale_order = request.website.sale_get_order(force_create=True) + sale_order.sudo().write({ + 'tables_ids': record_tables, + 'floors': kwargs.get('floors'), + 'date': kwargs.get('date'), + 'starting_at': kwargs.get('start_time'), + "ending_at": kwargs.get('end_time'), + 'booking_amount': sum(amount), + 'order_line': [ + (0, 0, { + 'name': request.env.ref( + 'table_reservation_on_website' + '.product_product_table_booking').name, + 'product_id': request.env.ref( + 'table_reservation_on_website' + '.product_product_table_booking').id, + 'product_uom_qty': 1, + 'price_unit': sum(amount), + })], + }) + sale_order.website_id = request.env['website'].search( + [('company_id', '=', company.id)], limit=1) + return request.redirect("/shop/cart") + else: + request.env['table.reservation'].sudo().create({ + "customer_id": request.env.user.partner_id.id, + "booked_tables_ids": record_tables, + "floor_id": kwargs.get('floors'), + "date": kwargs.get('date'), + "starting_at": kwargs.get('start_time'), + "ending_at": kwargs.get('end_time'), + 'booking_amount': 0, + 'state': 'reserved', + }) + return request.render( + "table_reservation_on_website.table_reserved_template") + + @http.route(['/table/reservation/pos'], type='json', auth='user', + website=True) + def table_reservation_pos(self, partner_id, table_id): + """ For pos table booking """ + table = request.env['restaurant.table'].browse(table_id) + date_and_time = datetime.now() + starting_at = ( + (date_and_time + timedelta(hours=5, minutes=30)).time()).strftime( + "%H:%M") + end_time = ( + (date_and_time + timedelta(hours=6, minutes=30)).time()).strftime( + "%H:%M") + payment = request.env['ir.config_parameter'].sudo().get_param( + "table_reservation_on_website.reservation_charge") + if payment: + request.env['table.reservation'].sudo().create({ + 'customer_id': partner_id, + 'floor_id': table.floor_id.id, + 'booked_tables_ids': table, + 'date': date_and_time.date(), + 'starting_at': starting_at, + 'ending_at': end_time, + 'booking_amount': table.rate, + 'state': 'reserved', + }) + else: + request.env['table.reservation'].sudo().create({ + 'customer_id': partner_id, + 'floor_id': table.floor_id.id, + 'booked_tables_ids': table, + 'date': date_and_time.date(), + 'starting_at': starting_at, + 'ending_at': end_time, + 'booking_amount': 0, + 'state': 'reserved', + }) + return + + @http.route(['/active/floor/tables'], type='json', auth='user', + website=True) + def active_floor_tables(self, floor_id): + """ To get active floors """ + table_inbetween = [] + table_reservation = request.env['table.reservation'].sudo().search([( + 'floor_id', "=", floor_id), ('date', '=', datetime.now().date()), + ('state', '=', 'reserved')]) + for rec in table_reservation: + start_at = datetime.strptime(rec.starting_at, "%H:%M").time() + end_at = datetime.strptime(rec.ending_at, "%H:%M").time() + now = ( + (datetime.now() + timedelta(hours=5, + minutes=30)).time()).strftime( + "%H:%M") + if start_at <= datetime.strptime(now, "%H:%M").time() <= end_at: + for table in rec.booked_tables_ids: + table_inbetween.append(table.id) + return table_inbetween diff --git a/table_reservation_on_website/data/product_product_data.xml b/table_reservation_on_website/data/product_product_data.xml new file mode 100644 index 000000000..c300d56f3 --- /dev/null +++ b/table_reservation_on_website/data/product_product_data.xml @@ -0,0 +1,15 @@ + + + + + Table Booking + 0 + 0 + product + + + Table Booking + TB + + + diff --git a/table_reservation_on_website/data/table_reservation_data.xml b/table_reservation_on_website/data/table_reservation_data.xml new file mode 100644 index 000000000..4742b3845 --- /dev/null +++ b/table_reservation_on_website/data/table_reservation_data.xml @@ -0,0 +1,13 @@ + + + + + + Table Reservation Sequence Number + table.reservation + TR + 3 + + + + diff --git a/table_reservation_on_website/doc/RELEASE_NOTES.md b/table_reservation_on_website/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..e9a1bcdd2 --- /dev/null +++ b/table_reservation_on_website/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 17.04.2024 +#### Version 17.0.1.0.0 +##### ADD +- Initial commit for Table Reservation on Website diff --git a/table_reservation_on_website/models/__init__.py b/table_reservation_on_website/models/__init__.py new file mode 100644 index 000000000..47575509d --- /dev/null +++ b/table_reservation_on_website/models/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import res_config_settings +from . import restaurant_table +from . import sale_order +from . import table_reservation diff --git a/table_reservation_on_website/models/res_config_settings.py b/table_reservation_on_website/models/res_config_settings.py new file mode 100644 index 000000000..6ad31c2a5 --- /dev/null +++ b/table_reservation_on_website/models/res_config_settings.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + """ Inheriting res config settings to add reservation details """ + _inherit = 'res.config.settings' + + reservation_charge = fields.Boolean(string="Reservation Charge", + help="Payment for pre booking tables", + config_parameter="table_" + "reservation_on_" + "website.reservation" + "_charge") + refund = fields.Text(string="No Refund Notes", + help="No refund notes to display in website") + + def set_values(self): + """ To set the value for fields in config setting """ + self.env['ir.config_parameter'].set_param( + 'table_reservation_on_website.refund', self.refund) + return super(ResConfigSettings, self).set_values() + + def get_values(self): + """ To get the value in config settings """ + res = super(ResConfigSettings, self).get_values() + refund = self.env['ir.config_parameter'].sudo().get_param( + 'table_reservation_on_website.refund') + res.update(refund=refund if refund else False) + return res diff --git a/table_reservation_on_website/models/restaurant_table.py b/table_reservation_on_website/models/restaurant_table.py new file mode 100644 index 000000000..bc97baad6 --- /dev/null +++ b/table_reservation_on_website/models/restaurant_table.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models + + +class RestaurantTable(models.Model): + """ Inherit restaurant table for adding rate field """ + _inherit = 'restaurant.table' + + rate = fields.Float(string="Amount", + help="Amount for reservation of this table") diff --git a/table_reservation_on_website/models/sale_order.py b/table_reservation_on_website/models/sale_order.py new file mode 100644 index 000000000..10915923c --- /dev/null +++ b/table_reservation_on_website/models/sale_order.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models + + +class SaleOrder(models.Model): + """ Inherit sale order for adding new fields """ + _inherit = 'sale.order' + + table_reservation_id = fields.Many2one( + comodel_name='table.reservation', + string="Table Reservation", + help="Can view the table reservation", readonly=True) + tables_ids = fields.Many2many("restaurant.table", string="tables", + help="Booked Tables") + floors = fields.Integer(string="Floor Number", help="Number of the Floor") + date = fields.Date(string="Date", help="Date of reservation") + starting_at = fields.Char(string="Starting At", + help="starting time of reservation") + ending_at = fields.Char(string="Ending At", + help="Ending time of reservation") + booking_amount = fields.Float(string="Booking Amount", + help="Booking Charge") diff --git a/table_reservation_on_website/models/table_reservation.py b/table_reservation_on_website/models/table_reservation.py new file mode 100644 index 000000000..f7da0bdae --- /dev/null +++ b/table_reservation_on_website/models/table_reservation.py @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from datetime import datetime +import re +from odoo import _, api, fields, models +from odoo.exceptions import UserError + + +class TableReservation(models.Model): + """ Create new model table reservation """ + _name = "table.reservation" + _description = 'Table Reservation' + _rec_name = 'sequence' + + sequence = fields.Char(string='Sequence', default=_('New'), readonly=True, + copy=False, help="Sequence number for records") + customer_id = fields.Many2one(comodel_name="res.partner", + string="Customer", + help="Name of the customer", + required=True) + floor_id = fields.Many2one(comodel_name='restaurant.floor', + string="Floor Plan", + help="Booked floor", required=True) + booked_tables_ids = fields.Many2many(comodel_name='restaurant.table', + string="Tables", required=True, + help="Booked tables") + date = fields.Date(string="Date", help="Date of reservation", + required=True) + starting_at = fields.Char(string="Starting At", + help="starting time of reservation", + required=True) + ending_at = fields.Char(string="Ending At", + help="Ending time of reservation", + required=True) + booking_amount = fields.Float(string="Booking Charge", + help="Amount for booking", + compute="_compute_booking_amount") + state = fields.Selection([('draft', "Draft"), ('reserved', 'Reserved'), + ('done', "Done"), ("cancel", "Cancelled")], + default='draft', string="Status", + help="State for records") + + @api.model + def create(self, vals): + """ Super create function to add sequence number """ + vals['sequence'] = self.env['ir.sequence'].next_by_code( + "table.reservation") + return super(TableReservation, self).create(vals) + + @api.onchange('starting_at', 'ending_at') + def _onchange_time(self): + """ Pattern for time """ + for record in self: + if record.starting_at: + pattern = r'^([01]\d|2[0-3]):([0-5]\d)$' + if not re.match(pattern, record.starting_at): + raise UserError(_("Invalid time format! [ " + "format HH:MM]")) + if record.ending_at: + pattern = r'^([01]\d|2[0-3]):([0-5]\d)$' + if not re.match(pattern, record.ending_at): + raise UserError(_("Invalid time format! [ " + "format HH:MM]")) + + @api.onchange("floor_id") + def _onchange_floor_id(self): + """ To show the tables corresponding the floor """ + tables = self.env['restaurant.table'].search([('floor_id', '=', + self.floor_id.id)]) + table_inbetween = [] + reserved = self.search([('floor_id', '=', self.floor_id.id), ('date', + '=', + self.date), + ('state', '=', 'reserved')]) + if self.starting_at: + start_time_new = datetime.strptime( + self.starting_at, "%H:%M").time() + for rec in reserved: + start_at = datetime.strptime(rec.starting_at, "%H:%M").time() + end_at = datetime.strptime(rec.ending_at, "%H:%M").time() + if start_at <= start_time_new <= end_at: + for table in rec.booked_tables_ids: + table_inbetween.append(table.id) + table_floor = [rec.id for rec in tables if + rec.id not in table_inbetween] + domain = [('id', 'in', table_floor)] + return {'domain': {'booked_tables_ids': domain}} + + @api.depends("booked_tables_ids") + def _compute_booking_amount(self): + """ For computing the booking amount """ + payment = self.env['ir.config_parameter'].sudo().get_param( + "table_reservation_on_website.reservation_charge") + if payment: + if self.booked_tables_ids: + sum_amount = [rec.rate for rec in self.booked_tables_ids] + self.booking_amount = sum(sum_amount) + else: + self.booking_amount = 0 + else: + self.booking_amount = 0 + + def action_cancel(self): + """ To cancel booking """ + self.write({ + 'state': 'cancel' + }) + + def action_reserved(self): + """ To reserve booking """ + self.write({ + 'state': "reserved" + }) + + def action_done(self): + """ Change state into done """ + self.write({ + 'state': 'done' + }) diff --git a/table_reservation_on_website/security/ir.model.access.csv b/table_reservation_on_website/security/ir.model.access.csv new file mode 100644 index 000000000..c4a8a0a38 --- /dev/null +++ b/table_reservation_on_website/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +table_reservation_on_website.access_table_reservation,access.table.reservation,table_reservation_on_website.model_table_reservation,base.group_user,1,1,1,1 diff --git a/table_reservation_on_website/static/description/assets/icons/capture (1).png b/table_reservation_on_website/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/capture (1).png differ diff --git a/table_reservation_on_website/static/description/assets/icons/check.png b/table_reservation_on_website/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/check.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/chevron.png b/table_reservation_on_website/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/chevron.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/cogs.png b/table_reservation_on_website/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/cogs.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/consultation.png b/table_reservation_on_website/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/consultation.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/ecom-black.png b/table_reservation_on_website/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/ecom-black.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/education-black.png b/table_reservation_on_website/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/education-black.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/hotel-black.png b/table_reservation_on_website/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/hotel-black.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/img.png b/table_reservation_on_website/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/img.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/license.png b/table_reservation_on_website/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/license.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/lifebuoy.png b/table_reservation_on_website/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/lifebuoy.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/manufacturing-black.png b/table_reservation_on_website/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/manufacturing-black.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/photo-capture.png b/table_reservation_on_website/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/photo-capture.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/pos-black.png b/table_reservation_on_website/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/pos-black.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/puzzle.png b/table_reservation_on_website/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/puzzle.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/restaurant-black.png b/table_reservation_on_website/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/restaurant-black.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/service-black.png b/table_reservation_on_website/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/service-black.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/trading-black.png b/table_reservation_on_website/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/trading-black.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/training.png b/table_reservation_on_website/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/training.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/update.png b/table_reservation_on_website/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/update.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/user.png b/table_reservation_on_website/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/user.png differ diff --git a/table_reservation_on_website/static/description/assets/icons/wrench.png b/table_reservation_on_website/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/wrench.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/Cybrosys R.png b/table_reservation_on_website/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/Cybrosys R.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/email.svg b/table_reservation_on_website/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/table_reservation_on_website/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/table_reservation_on_website/static/description/assets/misc/phone.svg b/table_reservation_on_website/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/table_reservation_on_website/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/table_reservation_on_website/static/description/assets/misc/star (1) 2.svg b/table_reservation_on_website/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/table_reservation_on_website/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/table_reservation_on_website/static/description/assets/misc/support (1) 1.svg b/table_reservation_on_website/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/table_reservation_on_website/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/table_reservation_on_website/static/description/assets/misc/support-email.svg b/table_reservation_on_website/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/table_reservation_on_website/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/table_reservation_on_website/static/description/assets/misc/tick-mark.svg b/table_reservation_on_website/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/table_reservation_on_website/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/table_reservation_on_website/static/description/assets/misc/whatsapp 1.svg b/table_reservation_on_website/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/table_reservation_on_website/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/table_reservation_on_website/static/description/assets/misc/whatsapp.svg b/table_reservation_on_website/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/table_reservation_on_website/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/table_reservation_on_website/static/description/assets/modules/custom_receipts_for_pos.png b/table_reservation_on_website/static/description/assets/modules/custom_receipts_for_pos.png new file mode 100644 index 000000000..399c39ce9 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/custom_receipts_for_pos.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/pos_access_right_hr.png b/table_reservation_on_website/static/description/assets/modules/pos_access_right_hr.png new file mode 100644 index 000000000..167308cca Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/pos_access_right_hr.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/pos_delete_orderline.png b/table_reservation_on_website/static/description/assets/modules/pos_delete_orderline.png new file mode 100644 index 000000000..adc353fc2 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/pos_delete_orderline.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/pos_lot_expiry_warning.png b/table_reservation_on_website/static/description/assets/modules/pos_lot_expiry_warning.png new file mode 100644 index 000000000..97b99f44a Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/pos_lot_expiry_warning.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/pos_receipt_extend.png b/table_reservation_on_website/static/description/assets/modules/pos_receipt_extend.png new file mode 100644 index 000000000..c11f7d6fb Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/pos_receipt_extend.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/pos_report_generator.png b/table_reservation_on_website/static/description/assets/modules/pos_report_generator.png new file mode 100644 index 000000000..c8edd3846 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/pos_report_generator.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/1.png b/table_reservation_on_website/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..6093b173a Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/1.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/10.png b/table_reservation_on_website/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..95d630ac4 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/10.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/2.png b/table_reservation_on_website/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..20e7cd691 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/2.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/3.png b/table_reservation_on_website/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..857c81557 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/3.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 new file mode 100644 index 000000000..3a3223d2d Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/4.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/5.png b/table_reservation_on_website/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..2cb4d1e51 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/5.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/6.png b/table_reservation_on_website/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..826335f2a Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/6.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/7.png b/table_reservation_on_website/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..7cde7967d Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/7.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/8.png b/table_reservation_on_website/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..90fefae15 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/8.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/9.png b/table_reservation_on_website/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..c7f682c49 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/9.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/hero.gif b/table_reservation_on_website/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..3ab0406bc Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/hero.gif differ diff --git a/table_reservation_on_website/static/description/banner.png b/table_reservation_on_website/static/description/banner.png new file mode 100644 index 000000000..0a4e1042a Binary files /dev/null and b/table_reservation_on_website/static/description/banner.png differ diff --git a/table_reservation_on_website/static/description/icon.png b/table_reservation_on_website/static/description/icon.png new file mode 100644 index 000000000..0e3718fa6 Binary files /dev/null and b/table_reservation_on_website/static/description/icon.png differ diff --git a/table_reservation_on_website/static/description/index.html b/table_reservation_on_website/static/description/index.html new file mode 100644 index 000000000..99b43bc11 --- /dev/null +++ b/table_reservation_on_website/static/description/index.html @@ -0,0 +1,631 @@ + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Table Reservation on Website

+

+ Reserve Tables in POS through Website. +

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Reserve Tables Through Website.

+

Users will be Able to Choose the Tables and Date. +

+
+
+
+
+
+
+ +
+
+

Reserved Tables will be Displayed in POS.

+

+ Tables Reserved will be Displayed with a Reserved + Label in POS, so it Makes Easy to Identify Reserved Tables. +

+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+

+ Reservation Charge.

+

+ Enable the Reservation Charge if Payment is needed to Reserve Tables, Otherwise there will be no Payments. +

+
+
+
+
+
+
+ +
+
+ +
+
+

+ Add Reservation Amount for POS Tables in Floors.

+
+
+
+
+
+
+ +
+
+

+ Select Booking Date and Time.

+
+
+
+
+
+
+ +
+
+

+ Select Floor.

+
+
+
+
+
+
+ +
+
+

+ Table Reservation.

+

Click the Button 'Booking Confirm' After Selecting the Tables. +

+
+
+
+
+
+
+ +
+
+ +
+
+

+ Table Reservation Details.

+
+
+
+
+
+
+ +
+
+

+ Cart.

+

+ Redirect to Cart page while Clicking the Button 'Booking Confirm'. +

+
+
+
+
+
+
+ +
+
+

+ Sale Order.

+

+ In sale order we can see the Table Reservation details. +

+
+
+
+
+
+
+
    +
  • + Community and Enterprise Support. +
  • +
  • + Able to Reserve Tables from Website. +
  • +
  • + Displays Reserved Tables in POS. +
  • +
  • + Creates Sale Order for Reservations. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:17th May 2024 +
+

+ Initial Commit for Table Reservation on Website.

+
+
+
+
+
+
+
+

Related Products

+
+
+ +
+
+

Our Services

+
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire Odoo Developer

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Licensing Consultancy

+
+
+
+
+
+
+

Our Industries

+
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

Education

+

A platform for educational management

+
+
+
+
+ +

Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service Management

+

Keep track of services and invoice

+
+
+
+
+ +

Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to us on WhatsApp!

+
+91 + 99456767686
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/table_reservation_on_website/static/img/table.png b/table_reservation_on_website/static/img/table.png new file mode 100644 index 000000000..4d5e8b9d1 Binary files /dev/null and b/table_reservation_on_website/static/img/table.png differ diff --git a/table_reservation_on_website/static/src/images/logo.jpg b/table_reservation_on_website/static/src/images/logo.jpg new file mode 100644 index 000000000..4f970096b Binary files /dev/null and b/table_reservation_on_website/static/src/images/logo.jpg differ diff --git a/table_reservation_on_website/static/src/js/FloorScreen.js b/table_reservation_on_website/static/src/js/FloorScreen.js new file mode 100644 index 000000000..abf3991b0 --- /dev/null +++ b/table_reservation_on_website/static/src/js/FloorScreen.js @@ -0,0 +1,30 @@ +/** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +import { FloorScreen } from "@pos_restaurant/app/floor_screen/floor_screen"; +import { jsonrpc } from "@web/core/network/rpc_service"; +patch(FloorScreen.prototype, { + setup() { + super.setup(...arguments); + }, + /** + For payment validation in pos + **/ + get activeTables() { + var self = this + jsonrpc('/active/floor/tables', {'floor_id' : self.activeFloor.id, + }).then( function(data){ + self.tables = data + }); + let reserved_tables = [] + for(let rec in self.tables){ + let new_tables = self.activeFloor.tables.find(item => item['id'] == self.tables[rec]) + if (new_tables){ + reserved_tables.push(new_tables) + } + } + reserved_tables.forEach(function(record){ + record.reserved = true; + }); + return self.activeFloor ? self.activeFloor.tables : null; + } +}); diff --git a/table_reservation_on_website/static/src/js/PaymentScreen.js b/table_reservation_on_website/static/src/js/PaymentScreen.js new file mode 100644 index 000000000..a8a81e93d --- /dev/null +++ b/table_reservation_on_website/static/src/js/PaymentScreen.js @@ -0,0 +1,19 @@ +/** @odoo-module **/ +import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen"; +import { jsonrpc } from "@web/core/network/rpc_service"; +import { patch } from "@web/core/utils/patch"; + +patch(PaymentScreen.prototype, { + /** + For payment validation in pos + **/ + async _finalizeValidation() { + var self = this + let customer = this.currentOrder.get_partner(); + ajax.jsonRpc('/table/reservation/pos','call',{ + 'partner_id' : customer.id, + 'table_id': this.currentOrder.tableId + }).then( function(data){}); + return super._finalizeValidation() + } +}); diff --git a/table_reservation_on_website/static/src/js/reservation_floor.js b/table_reservation_on_website/static/src/js/reservation_floor.js new file mode 100644 index 000000000..9873e6d94 --- /dev/null +++ b/table_reservation_on_website/static/src/js/reservation_floor.js @@ -0,0 +1,37 @@ +/** @odoo-module */ +import publicWidget from "@web/legacy/js/public/public_widget"; +let booked_table = [] +publicWidget.registry.table_reservation_floor = publicWidget.Widget.extend({ + selector: '#tableContainer', + events: { + 'click .card_table': '_onTableClick', + }, + /** + Select table for reservation + **/ + _onTableClick: function () { + var current_div_id = event.target.closest('.card_table') + var rate = current_div_id.querySelector('#rate').innerText + var count = this.$el.find('#count_table')[0]; + var amount = this.$el.find('#total_amount')[0]; + var booked = this.$el.find('#tables_input')[0]; + if (current_div_id.style.backgroundColor == 'green'){ + booked_table.splice(booked_table.indexOf(Number(current_div_id.id)), 1); + current_div_id.style.backgroundColor = '#96ccd5'; + count.innerText = Number(count.innerText) - 1; + amount.innerText = Number(amount.innerText) - Number(rate) + } + else{ + current_div_id.style.backgroundColor = 'green' + count.innerText = Number(count.innerText) + 1; + booked_table.push(Number(current_div_id.id)) + if (amount.innerText){ + amount.innerText = Number(rate) + Number(amount.innerText) + } + else{ + amount.innerText = Number(rate) + } + } + booked.value = booked_table + }, +}); diff --git a/table_reservation_on_website/static/src/js/table_reservation.js b/table_reservation_on_website/static/src/js/table_reservation.js new file mode 100644 index 000000000..4ecfb349a --- /dev/null +++ b/table_reservation_on_website/static/src/js/table_reservation.js @@ -0,0 +1,40 @@ +/** @odoo-module */ +import publicWidget from "@web/legacy/js/public/public_widget"; +import { jsonrpc } from "@web/core/network/rpc_service"; +publicWidget.registry.table_reservation = publicWidget.Widget.extend({ + selector: '#restaurant_floors', + events: { + 'change #floors_rest': '_onFloorChange', + 'click .card_table': '_onTableClick', + }, + /** + To get all tables belongs to the floor + **/ + _onFloorChange: function (ev) { + var floors = this.$el.find("#floors_rest")[0].value; + var date = $("#date_booking").text().trim() + var start = $("#booking_start").text() + document.getElementById('count_table').innerText = 0; + document.getElementById('total_amount').innerText = 0; + jsonrpc("/restaurant/floors/tables", {'floors_id' : floors, + 'date': date, 'start':start,}) + .then(function (data) { + if(floors == 0){ + $('#table_container_row').empty(); + $('#info').hide(); + } + else{ + $('#table_container_row').empty(); + $('#info').show(); + for (let i in data){ + $('#table_container_row').append('
' +data[i]['name'] + + '


'+ data[i]['seats']+ + '
' + + data[i]['rate'] + + '/Slot

'); + } + } + }); + }, +}); diff --git a/table_reservation_on_website/static/src/scss/style.css b/table_reservation_on_website/static/src/scss/style.css new file mode 100644 index 000000000..228e24d64 --- /dev/null +++ b/table_reservation_on_website/static/src/scss/style.css @@ -0,0 +1,21 @@ +.floor-map .reserved-border{ + border: 5px solid black; +} +.floor-map .reserved-border .table-reserved{ + display: flex; + justify-content: center; +} +.floor-map .reserved-border .table-reserved .reserved-label{ + position: absolute; + top: 15px; + background: #ff0000; + width: 80px; + margin-top: -4px; + height: 20px; + line-height: 20px; + border-radius: 5px; + font-size: 16px; + z-index: 10; + color: white; + padding-left: 7px; +} diff --git a/table_reservation_on_website/static/src/xml/FloorScreen.xml b/table_reservation_on_website/static/src/xml/FloorScreen.xml new file mode 100644 index 000000000..f468d9a20 --- /dev/null +++ b/table_reservation_on_website/static/src/xml/FloorScreen.xml @@ -0,0 +1,19 @@ + + diff --git a/table_reservation_on_website/views/res_config_settings_views.xml b/table_reservation_on_website/views/res_config_settings_views.xml new file mode 100644 index 000000000..c4cb9bbc3 --- /dev/null +++ b/table_reservation_on_website/views/res_config_settings_views.xml @@ -0,0 +1,31 @@ + + + + + res.config.settings.view.form.inherit.table.reservation.on.website + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+
+
+
diff --git a/table_reservation_on_website/views/restaurant_floor_views.xml b/table_reservation_on_website/views/restaurant_floor_views.xml new file mode 100644 index 000000000..c2702a71b --- /dev/null +++ b/table_reservation_on_website/views/restaurant_floor_views.xml @@ -0,0 +1,16 @@ + + + + + restaurant.floor.view.form.inherit.table.reservation.on.website + restaurant.floor + + + + + + + + diff --git a/table_reservation_on_website/views/restaurant_table_views.xml b/table_reservation_on_website/views/restaurant_table_views.xml new file mode 100644 index 000000000..0ff6c6c35 --- /dev/null +++ b/table_reservation_on_website/views/restaurant_table_views.xml @@ -0,0 +1,14 @@ + + + + + restaurant.table.view.form.inherit.table.reservation.on.website + restaurant.table + + + + + + + + diff --git a/table_reservation_on_website/views/sale_order_views.xml b/table_reservation_on_website/views/sale_order_views.xml new file mode 100644 index 000000000..db3dfba88 --- /dev/null +++ b/table_reservation_on_website/views/sale_order_views.xml @@ -0,0 +1,20 @@ + + + + + sale.order.view.form.inherit.table.reservation.on.website + sale.order + + + + + + + + + + + + + + diff --git a/table_reservation_on_website/views/table_reservation_on_website_menus.xml b/table_reservation_on_website/views/table_reservation_on_website_menus.xml new file mode 100644 index 000000000..201f3f62c --- /dev/null +++ b/table_reservation_on_website/views/table_reservation_on_website_menus.xml @@ -0,0 +1,10 @@ + + + + + Table Reservation + /table_reservation + + 55 + + diff --git a/table_reservation_on_website/views/table_reservation_templates.xml b/table_reservation_on_website/views/table_reservation_templates.xml new file mode 100644 index 000000000..438b30a6b --- /dev/null +++ b/table_reservation_on_website/views/table_reservation_templates.xml @@ -0,0 +1,216 @@ + + + + + + + + diff --git a/table_reservation_on_website/views/table_reservation_views.xml b/table_reservation_on_website/views/table_reservation_views.xml new file mode 100644 index 000000000..aba92184c --- /dev/null +++ b/table_reservation_on_website/views/table_reservation_views.xml @@ -0,0 +1,71 @@ + + + + + table.reservation.view.tree + table.reservation + + + + + + + + + + + + + + table.reservation.view.form + table.reservation + +
+
+
+ +
+

+ +

+
+ + + + + + + + + + + +
+
+
+
+ + + Table Reservation + table.reservation + list,form + + + +
diff --git a/table_reservation_on_website/views/table_reserved_templates.xml b/table_reservation_on_website/views/table_reserved_templates.xml new file mode 100644 index 000000000..d213d6bf9 --- /dev/null +++ b/table_reservation_on_website/views/table_reserved_templates.xml @@ -0,0 +1,24 @@ + + + + +