diff --git a/table_reservation_on_website/README.rst b/table_reservation_on_website/README.rst new file mode 100644 index 000000000..6e2fe77bb --- /dev/null +++ b/table_reservation_on_website/README.rst @@ -0,0 +1,47 @@ +.. 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: (V16) - 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..0979775af --- /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': '16.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/res_config_settings_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.jpg'], + '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..14ced6e23 --- /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.payment.controllers.post_processing import PaymentPostProcessing +from odoo.addons.website_sale.controllers.main import WebsiteSale + + +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..4ab1753d5 --- /dev/null +++ b/table_reservation_on_website/controllers/table_reservation_on_website.py @@ -0,0 +1,210 @@ +# -*- 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['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"), "%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..dbc6007a7 --- /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..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..f2e3f3d79 --- /dev/null +++ b/table_reservation_on_website/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 10.11.2023 +#### Version 16.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..3503da5ff --- /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 res_config_settings +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..7d2ea6f27 --- /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) 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 ResConfigSettings(models.TransientModel): + """Inherit the model res config settings""" + _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 a 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..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..6caebb068 --- /dev/null +++ b/table_reservation_on_website/models/table_reservation.py @@ -0,0 +1,138 @@ +# -*- 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", 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 _constrains_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['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): + """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..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/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/barcode.png b/table_reservation_on_website/static/description/assets/modules/barcode.png new file mode 100644 index 000000000..618e3e6c4 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/barcode.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/customer_geolocation.png b/table_reservation_on_website/static/description/assets/modules/customer_geolocation.png new file mode 100644 index 000000000..6058f6c3b Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/customer_geolocation.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/product_brand.png b/table_reservation_on_website/static/description/assets/modules/product_brand.png new file mode 100644 index 000000000..1d2238b80 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/product_brand.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/website_cart.png b/table_reservation_on_website/static/description/assets/modules/website_cart.png new file mode 100644 index 000000000..163485cfd Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/website_cart.png differ diff --git a/table_reservation_on_website/static/description/assets/modules/website_favourites_grid.jpg b/table_reservation_on_website/static/description/assets/modules/website_favourites_grid.jpg new file mode 100644 index 000000000..483dd03a4 Binary files /dev/null and b/table_reservation_on_website/static/description/assets/modules/website_favourites_grid.jpg 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..ed175b076 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/screenshots/1.png b/table_reservation_on_website/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..74413ab25 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..c02e5bda1 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..a7d21a05f 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..6c4e08958 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..7d8246b4a 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..15198caf8 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..ddbe0371c 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..4955f2f2a 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..2ba7861f6 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/2.png b/table_reservation_on_website/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..f222daf20 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..02c40b6a3 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..1228a3a42 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..cf30adeff 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..0f9c39ec6 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..a62c44328 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..e9883eec2 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..b9d30d794 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.jpg b/table_reservation_on_website/static/description/banner.jpg new file mode 100644 index 000000000..6ae5ba0b5 Binary files /dev/null and b/table_reservation_on_website/static/description/banner.jpg 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..d93b69d82 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..04b98b799 --- /dev/null +++ b/table_reservation_on_website/static/description/index.html @@ -0,0 +1,728 @@ +
+ +
+ +
+
+ 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

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

+ 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..7fce9c48c --- /dev/null +++ b/table_reservation_on_website/static/src/js/FloorScreen.js @@ -0,0 +1,29 @@ +/** @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'; +const TableFloor = (FloorScreen) => +class extends FloorScreen { +/** +For getting active tables +**/ + get activeTables() { + var self = this + ajax.jsonRpc('/active/floor/tables','call',{ + 'floor_id' : self.activeFloor.id, + }).then( function(data){ + self.tables = data + }); + self.activeFloor.tables.forEach(function(record){ + for(let rec in self.tables){ + if(self.tables[rec] == record['id']){ + let new_tables = self.activeFloor.tables.filter(item => item['id'] !== self.tables[rec]) + self.activeFloor.tables = new_tables; + } + } + }); + return self.activeFloor.tables; + } +} +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..4df139dc0 --- /dev/null +++ b/table_reservation_on_website/static/src/js/PaymentScreen.js @@ -0,0 +1,22 @@ +/** @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 + 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() + } +} +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..63d9f5de3 --- /dev/null +++ b/table_reservation_on_website/static/src/js/reservation_floor.js @@ -0,0 +1,37 @@ +/** @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]; + 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..98d099113 --- /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/res_config_settings_views.xml b/table_reservation_on_website/views/res_config_settings_views.xml new file mode 100644 index 000000000..ccdc53476 --- /dev/null +++ b/table_reservation_on_website/views/res_config_settings_views.xml @@ -0,0 +1,32 @@ + + + + + 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..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..da28ec43a --- /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..261f7108f --- /dev/null +++ b/table_reservation_on_website/views/table_reservation_templates.xml @@ -0,0 +1,228 @@ + + + + + + + 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..7e6e7d167 --- /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..a51ef88ed --- /dev/null +++ b/table_reservation_on_website/views/table_reserved_templates.xml @@ -0,0 +1,24 @@ + + + + +