diff --git a/table_reservation_on_website/README.rst b/table_reservation_on_website/README.rst new file mode 100644 index 000000000..3cc9a72fc --- /dev/null +++ b/table_reservation_on_website/README.rst @@ -0,0 +1,46 @@ +.. 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 table through website + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Lesser General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +Developer: (V15) Fathima Mazlin AM, 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..8058e5c9e --- /dev/null +++ b/table_reservation_on_website/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM(odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# 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..08800ea37 --- /dev/null +++ b/table_reservation_on_website/__manifest__.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM(odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# along with this program. If not, see . +# +############################################################################### +{ + 'name': 'Table Reservation on Website', + 'version': '15.0.1.0.0', + 'category': 'eCommerce,Point of Sale', + 'summary': 'We can reserve table through website', + 'description': 'We can reserve table through website. And also user can ' + 'choose their table on website. Table, and other ' + 'information is fetch from point of sale', + '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/pos_config_views.xml', + ], + 'assets': { + 'point_of_sale.assets': [ + 'table_reservation_on_website/static/src/js/PaymentScreen.js', + 'table_reservation_on_website/static/src/js/FloorScreen.js', + ], + '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..4b23b6364 --- /dev/null +++ b/table_reservation_on_website/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM(odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# 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..6bc65324b --- /dev/null +++ b/table_reservation_on_website/controllers/main.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM (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.http import request +from odoo.addons.website_sale.controllers.main import WebsiteSale +from odoo.addons.payment.controllers.post_processing import PaymentPostProcessing + + +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') + tx = 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): + return request.redirect('/shop') + if order and not order.amount_total and not tx: + order.with_context(send_email=True).action_confirm() + return request.redirect(order.get_portal_url()) + request.website.sale_reset() + if tx and tx.state == 'draft': + return request.redirect('/shop') + PaymentPostProcessing.remove_transactions(tx) + 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..bc064dbbd --- /dev/null +++ b/table_reservation_on_website/controllers/table_reservation_on_website.py @@ -0,0 +1,217 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM (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 table reservation""" + + @http.route(['/table_reservation'], type='http', auth='user', website=True) + def table_reservation(self): + """For render 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['pos.config'].search([]) + for rec in payment: + if rec.module_pos_restaurant: + payment_status = rec.reservation_charge + refund = rec.refund + vals = { + 'floors': floors, + 'date': kwargs.get('date'), + 'start_time': kwargs.get('start_time'), + 'end_time': kwargs.get('end_time'), + 'payment': payment_status, + '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['pos.config'].search([]) + for rec in payment: + if rec.module_pos_restaurant: + payment_status = rec.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"), "%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_status: + 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['pos.config'].search([]) + for rec in payment: + if rec.module_pos_restaurant: + payment_status = rec.reservation_charge + if payment_status: + 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_templates") + + @http.route(['/table/reservation/pos'], type='json', auth='public', + 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['pos.config'].search([]) + for rec in payment: + if rec.module_pos_restaurant: + payment_status = rec.reservation_charge + if payment_status: + 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..57a4ff082 --- /dev/null +++ b/table_reservation_on_website/data/product_product_data.xml @@ -0,0 +1,18 @@ + + + + + + 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..c6da6d1a9 --- /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..c61545b9a --- /dev/null +++ b/table_reservation_on_website/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 26.12.2023 +#### Version 15.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..55a5d961b --- /dev/null +++ b/table_reservation_on_website/models/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM (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 restaurant_table +from . import pos_config +from . import sale_order +from . import table_reservation diff --git a/table_reservation_on_website/models/pos_config.py b/table_reservation_on_website/models/pos_config.py new file mode 100644 index 000000000..248d81e04 --- /dev/null +++ b/table_reservation_on_website/models/pos_config.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM (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 PosConfig(models.Model): + """Inherit the model res config settings""" + _inherit = 'pos.config' + + 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", + config_parameter="table_reservation_on_website.refund") 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..11db16b4f --- /dev/null +++ b/table_reservation_on_website/models/restaurant_table.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM (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 new field""" + _inherit = 'restaurant.table' + + rate = fields.Float(string="Amount", help="Amount of 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..af97df94c --- /dev/null +++ b/table_reservation_on_website/models/sale_order.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM (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="Floor Number") + 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..268d01092 --- /dev/null +++ b/table_reservation_on_website/models/table_reservation.py @@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Fathima Mazlin AM (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", + help="Booked tables", required=True + ) + 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 visible in status bar") + + @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(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['pos.config'].search([]) + for rec in payment: + if rec.module_pos_restaurant: + payment_status = rec.reservation_charge + if payment_status: + 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): + """For cancel button""" + self.write({ + 'state': 'cancel' + }) + + def action_reserved(self): + """For reserved button""" + self.write({ + 'state': "reserved" + }) + + def action_done(self): + """For done button""" + 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..99af45bd3 --- /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 +access_table_reservation_user,access.table.reservation.user,model_table_reservation,base.group_user,1,1,1,1 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/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/logo.png b/table_reservation_on_website/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/table_reservation_on_website/static/description/assets/icons/logo.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/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/categories.png b/table_reservation_on_website/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/categories.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/check-box.png b/table_reservation_on_website/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/check-box.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/compass.png b/table_reservation_on_website/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/compass.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/corporate.png b/table_reservation_on_website/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/corporate.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/customer-support.png b/table_reservation_on_website/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/customer-support.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/cybrosys-logo.png b/table_reservation_on_website/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/cybrosys-logo.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/features.png b/table_reservation_on_website/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/features.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/logo.png b/table_reservation_on_website/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/logo.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/pictures.png b/table_reservation_on_website/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/pictures.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/pie-chart.png b/table_reservation_on_website/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/pie-chart.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/right-arrow.png b/table_reservation_on_website/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/right-arrow.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/star.png b/table_reservation_on_website/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/star.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/support.png b/table_reservation_on_website/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/support.png differ diff --git a/table_reservation_on_website/static/description/assets/misc/whatsapp.png b/table_reservation_on_website/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/misc/whatsapp.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/delivery_date_ecommerce.png b/table_reservation_on_website/static/description/assets/modules/delivery_date_ecommerce.png new file mode 100644 index 000000000..5856d1b7e Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/delivery_date_ecommerce.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/openai_website_product_media.png b/table_reservation_on_website/static/description/assets/modules/openai_website_product_media.png new file mode 100644 index 000000000..5c172b9ab Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/openai_website_product_media.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/product_brand_ecommerce.png b/table_reservation_on_website/static/description/assets/modules/product_brand_ecommerce.png new file mode 100644 index 000000000..ae3e11bff Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/product_brand_ecommerce.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/website_multi_variant.png b/table_reservation_on_website/static/description/assets/modules/website_multi_variant.png new file mode 100644 index 000000000..b64b96d92 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/website_multi_variant.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/website_repeat_sale.png b/table_reservation_on_website/static/description/assets/modules/website_repeat_sale.png new file mode 100644 index 000000000..2b5926612 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/website_repeat_sale.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/wishlist_product_website_backend.png b/table_reservation_on_website/static/description/assets/modules/wishlist_product_website_backend.png new file mode 100644 index 000000000..aa9cb6262 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/wishlist_product_website_backend.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..6b230c9f0 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..d09d19026 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/11.png b/table_reservation_on_website/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..a101f59e0 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/11.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/12.png b/table_reservation_on_website/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..ed6ad7303 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/12.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/13.png b/table_reservation_on_website/static/description/assets/screenshots/13.png new file mode 100644 index 000000000..7eb06d246 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/13.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/14.png b/table_reservation_on_website/static/description/assets/screenshots/14.png new file mode 100644 index 000000000..dd8ba4a9e Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/14.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/15.png b/table_reservation_on_website/static/description/assets/screenshots/15.png new file mode 100644 index 000000000..e2dd78218 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/15.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/16.png b/table_reservation_on_website/static/description/assets/screenshots/16.png new file mode 100644 index 000000000..e319123c7 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/16.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/17.png b/table_reservation_on_website/static/description/assets/screenshots/17.png new file mode 100644 index 000000000..da662bf32 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/17.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/18.png b/table_reservation_on_website/static/description/assets/screenshots/18.png new file mode 100644 index 000000000..4e9aa58e9 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/18.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..8e9fe8d38 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..eae342951 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..d6433d65c 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..3703dc426 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..c6dcbc593 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..27d698a8d 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..8e2cba376 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/hero.gif b/table_reservation_on_website/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..da56067cc 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..f31ae400f 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..844fe683a 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..a3c268fef --- /dev/null +++ b/table_reservation_on_website/static/description/index.html @@ -0,0 +1,648 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Table Reservation on Website

+

+ We Can Reserve Table Through Website

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

Explore This + Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ We can reserve table through website. And also user can choose their + table on website. Table, and other information is fetch from point of sale. +
+
+ + + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Community and Enterprise Support. +
+
+ + Can reserve table from website. +
+
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+ +
+

Reservation Charge

+

If we enable "Reservation Charge" we want to pay for + reservation. If we disable "Reservation Charge" there is + no payment for table reservation.

+ +
+ +
+

Floors

+

+ We can add "Amount" for reservation in pos floor.

+ + +
+ +
+

Select Your Date and Time

+ +
+
+

Select your Floor

+ +
+
+

Table Reservation

+

+ Click the button "Booking Confirm" after selecting the + tables.

+ +
+

Successfully Reserved Template

+

+ we can we Reserved template while clicking"Booking Confirm".

+ +
+
+

Table Reservation Data

+ + +
+

Reservation Charge

+ +
+
+

No Refund Note

+

+ You can see the no refund note in website if enable "Reservation Charge".

+ +
+
+

Cart

+

+ Redirect to Cart page while clicking the button "Booking Confirm".

+ +
+
+

Payment Page

+

+ Redirect to Payment page while clicking the button "Process Checkout".

+ +
+
+

Payment Confirmation

+

+ Redirect to Payment Confirmation page while clicking the button "Pay Now".

+ +
+
+

Sale Order

+

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

+ +
+
+

Table Reservation

+ +
+
+

Pos Restaurant

+

+ We can't view already reserved tables.

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

+ Related + Products +

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

Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ 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 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file 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..470301526 --- /dev/null +++ b/table_reservation_on_website/static/src/js/FloorScreen.js @@ -0,0 +1,46 @@ +/** @odoo-module **/ +import FloorScreen from 'pos_restaurant.FloorScreen'; +import rpc from 'web.rpc'; +import ajax from 'web.ajax'; +import Registries from 'point_of_sale.Registries'; +import models from 'point_of_sale.models'; +/** To load model into pos **/ +models.load_models([{ + model: 'table.reservation', + fields: ['id', 'floor_id', 'booked_tables_ids', 'date', 'starting_at', + 'ending_at', 'state'], + loaded: function(self, table_reservation) { + self.table_reservation = table_reservation; + } +}]); +const TableFloor = (FloorScreen) => +class extends FloorScreen { + /** + For getting active tables + **/ + get activeTables(){ + var table_record = [] + var self = this + const now = new Date(); + const utc530Offset = 330 * 60 * 1000; + const timeWithOffset = new Date(now.getTime() + utc530Offset); + const formattedTime = timeWithOffset.toISOString().replace('T', ' ').substr(0, 16); + const [datePart, timePart] = formattedTime.split(' '); + self.activeFloor.tables.forEach(function(table){ + self.env.pos.table_reservation.forEach(function(record){ + if(record.floor_id[0] == self.activeFloor.id && record.date == datePart && record.state == "reserved"){ + if(record.starting_at <= timePart && timePart <= record.ending_at){ + record.booked_tables_ids.forEach(function(rec){ + if(rec == table['id']){ + table_record.push(rec); + } + }); + } + } + }); + }); + const updatedData = this.activeFloor.tables.filter(item => !table_record.includes(item["id"])); + return updatedData; + } +} +Registries.Component.extend(FloorScreen, TableFloor); 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..96fa12217 --- /dev/null +++ b/table_reservation_on_website/static/src/js/PaymentScreen.js @@ -0,0 +1,23 @@ +/** @odoo-module **/ +import PaymentScreen from 'point_of_sale.PaymentScreen'; +import rpc from 'web.rpc'; +import ajax from 'web.ajax'; +import Registries from 'point_of_sale.Registries'; + +const TableReservation = (PaymentScreen) => +class extends PaymentScreen { + /** + For payment validation in pos + **/ + async _finalizeValidation() { + var self = this + if (this.currentOrder.table){ + ajax.jsonRpc('/table/reservation/pos','call',{ + 'partner_id' : this.currentOrder.changed.client.id, + 'table_id': this.currentOrder.table.id, + }).then( function(data){}); + } + return super._finalizeValidation() + } +} +Registries.Component.extend(PaymentScreen, TableReservation); 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..098a134ed --- /dev/null +++ b/table_reservation_on_website/static/src/js/reservation_floor.js @@ -0,0 +1,41 @@ +/** @odoo-module */ +import publicWidget from 'web.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]; + var table_count = this.$el.find('#tables_counts')[0]; + count.innerText = table_count.value + 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) + table_count.value = Number(count.innerText); + } + else{ + current_div_id.style.backgroundColor = 'green' + count.innerText = Number(count.innerText) + 1; + booked_table.push(Number(current_div_id.id)) + table_count.value = Number(count.innerText); + 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..5b7c2f837 --- /dev/null +++ b/table_reservation_on_website/static/src/js/table_reservation.js @@ -0,0 +1,43 @@ +/** @odoo-module */ +import publicWidget from 'web.public.widget'; +import ajax from 'web.ajax'; +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 () { + var floors = this.$el.find("#floors_rest")[0].value; + var date = this.$el.find("#date_id").prevObject[0].offsetParent.lastElementChild[1].defaultValue + var start = this.$el.find("#start_id").prevObject[0].offsetParent.lastElementChild[2].defaultValue + document.getElementById('count_table').innerText = 0; + document.getElementById('total_amount').innerText = 0; + ajax.jsonRpc("/restaurant/floors/tables", 'call', { + '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/views/pos_config_views.xml b/table_reservation_on_website/views/pos_config_views.xml new file mode 100644 index 000000000..61a9c2c47 --- /dev/null +++ b/table_reservation_on_website/views/pos_config_views.xml @@ -0,0 +1,32 @@ + + + + + pos.config.view.form.inherit.table.reservation.on.website + pos.config + + + +
+
+ +
+
+
+
+
+
+
+
+
+
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..730265fd8 --- /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..0875a1b78 --- /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..fda52016e --- /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..dfa596c02 --- /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..759c30cc5 --- /dev/null +++ b/table_reservation_on_website/views/table_reservation_templates.xml @@ -0,0 +1,237 @@ + + + + + + + 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..fdf26e189 --- /dev/null +++ b/table_reservation_on_website/views/table_reservation_views.xml @@ -0,0 +1,72 @@ + + + + + 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..cebe1d89f --- /dev/null +++ b/table_reservation_on_website/views/table_reserved_templates.xml @@ -0,0 +1,24 @@ + + + + +