From 956b3c290f930f6542b67b038e2eb2895712ecb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20FRAN=C3=87OIS?= Date: Mon, 26 Oct 2020 15:38:04 +0100 Subject: [PATCH] [ADD] pos_restaurant_table_booking module --- pos_restaurant_table_booking/__init__.py | 2 + pos_restaurant_table_booking/__manifest__.py | 38 ++ .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 165 bytes pos_restaurant_table_booking/i18n/fr.po | 337 ++++++++++++++++++ .../i18n/pos_restaurant_table_booking.pot | 332 +++++++++++++++++ .../models/__init__.py | 5 + .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 312 bytes .../res_config_settings.cpython-37.pyc | Bin 0 -> 661 bytes .../restaurant_booking.cpython-37.pyc | Bin 0 -> 5780 bytes .../restaurant_table.cpython-37.pyc | Bin 0 -> 712 bytes .../restaurant_table_booking.cpython-37.pyc | Bin 0 -> 1072 bytes .../models/res_config_settings.py | 12 + .../models/restaurant_booking.py | 143 ++++++++ .../models/restaurant_table.py | 14 + .../models/restaurant_table_booking.py | 17 + .../security/ir_model_access.xml | 24 ++ .../views/res_config_settings.xml | 30 ++ .../views/restaurant_booking.xml | 137 +++++++ .../views/restaurant_floor.xml | 29 ++ .../views/restaurant_table.xml | 29 ++ .../views/restaurant_table_booking.xml | 103 ++++++ 21 files changed, 1252 insertions(+) create mode 100644 pos_restaurant_table_booking/__init__.py create mode 100644 pos_restaurant_table_booking/__manifest__.py create mode 100644 pos_restaurant_table_booking/__pycache__/__init__.cpython-37.pyc create mode 100644 pos_restaurant_table_booking/i18n/fr.po create mode 100644 pos_restaurant_table_booking/i18n/pos_restaurant_table_booking.pot create mode 100644 pos_restaurant_table_booking/models/__init__.py create mode 100644 pos_restaurant_table_booking/models/__pycache__/__init__.cpython-37.pyc create mode 100644 pos_restaurant_table_booking/models/__pycache__/res_config_settings.cpython-37.pyc create mode 100644 pos_restaurant_table_booking/models/__pycache__/restaurant_booking.cpython-37.pyc create mode 100644 pos_restaurant_table_booking/models/__pycache__/restaurant_table.cpython-37.pyc create mode 100644 pos_restaurant_table_booking/models/__pycache__/restaurant_table_booking.cpython-37.pyc create mode 100644 pos_restaurant_table_booking/models/res_config_settings.py create mode 100644 pos_restaurant_table_booking/models/restaurant_booking.py create mode 100644 pos_restaurant_table_booking/models/restaurant_table.py create mode 100644 pos_restaurant_table_booking/models/restaurant_table_booking.py create mode 100644 pos_restaurant_table_booking/security/ir_model_access.xml create mode 100644 pos_restaurant_table_booking/views/res_config_settings.xml create mode 100644 pos_restaurant_table_booking/views/restaurant_booking.xml create mode 100644 pos_restaurant_table_booking/views/restaurant_floor.xml create mode 100644 pos_restaurant_table_booking/views/restaurant_table.xml create mode 100644 pos_restaurant_table_booking/views/restaurant_table_booking.xml diff --git a/pos_restaurant_table_booking/__init__.py b/pos_restaurant_table_booking/__init__.py new file mode 100644 index 0000000..a0fdc10 --- /dev/null +++ b/pos_restaurant_table_booking/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/pos_restaurant_table_booking/__manifest__.py b/pos_restaurant_table_booking/__manifest__.py new file mode 100644 index 0000000..31f5819 --- /dev/null +++ b/pos_restaurant_table_booking/__manifest__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + 'name': "POS Restaurant Table Booking", + 'version': '1.0.0', + 'summary': """ + """, + 'description': """ + """, + 'author': "La Case", + 'website': "http://www.lacase-jeux.com", + 'maintainer': "La Case", + 'license': 'AGPL-3', + 'category': 'Point of Sale', + 'depends': [ + 'pos_restaurant', + ], + 'excludes': [], + 'external_dependencies': {}, + 'data': [ + 'security/ir_model_access.xml', + 'views/res_config_settings.xml', + 'views/restaurant_booking.xml', + 'views/restaurant_floor.xml', + 'views/restaurant_table_booking.xml', + 'views/restaurant_table.xml', + ], + 'qweb': [], + 'css': [], + 'images': [], + 'demo': [], + 'installable': True, + 'auto_install': False, + 'application': False, + 'pre_init_hook': '', + 'post_init_hook': '', + 'uninstall_hook': '', +} diff --git a/pos_restaurant_table_booking/__pycache__/__init__.cpython-37.pyc b/pos_restaurant_table_booking/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8063829b81f8ce59d80f8cc4a64a841289580620 GIT binary patch literal 165 zcmZ?b<>g`k0w<*j@w!0zF^B^LOhASM5Elyoi4=wu#vF!R#wbQch7_h?22JLdj6h*c z##?N;`6;P6#eSMhw-|~*dR8(Nu>dJB@k?JnBR@A)KR+cuUq3M=B|ooNzaYOjz9caz pCpA7PKR-J&FI_)AJ~J<~BtBlRpz;=n4bZ&OoK!oIQJ;aB0RXo`CQSeU literal 0 HcmV?d00001 diff --git a/pos_restaurant_table_booking/i18n/fr.po b/pos_restaurant_table_booking/i18n/fr.po new file mode 100644 index 0000000..69f5bcc --- /dev/null +++ b/pos_restaurant_table_booking/i18n/fr.po @@ -0,0 +1,337 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_restaurant_table_booking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-26 13:59+0000\n" +"PO-Revision-Date: 2020-10-26 13:59+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_form +msgid "" +"\n" +" The total seats of selected tables is lower than the people count." +msgstr "\n" +" Le nombre de places cumulé des tables sélectionnées est inférieur à l'effectif." + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_form +msgid "from" +msgstr "de" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_form +msgid "to" +msgstr "à" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Duration : " +msgstr "Durée : " + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Start : " +msgstr "Début : " + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "People count : " +msgstr "Effectif : " + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Stop : " +msgstr "Fin : " + +#. module: pos_restaurant_table_booking +#: model:ir.actions.act_window,name:pos_restaurant_table_booking.restaurant_booking_act_window +#: model:ir.ui.menu,name:pos_restaurant_table_booking.restaurant_booking_menu +msgid "All bookings" +msgstr "Toutes les réservations" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__available_table_ids +msgid "Available tables" +msgstr "Tables disponibles" + +#. module: pos_restaurant_table_booking +#: model:ir.ui.menu,name:pos_restaurant_table_booking.restaurant_booking_root_menu +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.res_config_settings_form +msgid "Bookings" +msgstr "Réservations" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__table_capacity +msgid "Capacity" +msgstr "Capacité" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__table_capacity_ok +msgid "Capacity OK" +msgstr "Capacité OK" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__color +msgid "Color" +msgstr "Couleur" + +#. module: pos_restaurant_table_booking +#: model:ir.model,name:pos_restaurant_table_booking.model_res_config_settings +msgid "Config Settings" +msgstr "Paramètres de config" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__create_uid +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__create_date +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__date +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Date" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__datetime_start +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__datetime_start +msgid "Date start" +msgstr "Date début" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__datetime_stop +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__datetime_stop +msgid "Date stop" +msgstr "Date fin" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_res_config_settings__default_duration +msgid "Default duration" +msgstr "Durée par défaut" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__display_name +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table__display_name +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__duration +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__duration +msgid "Duration" +msgstr "Durée" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Filters" +msgstr "Filtres" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Group By" +msgstr "Grouper par" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_res_config_settings__id +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__id +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table__id +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__id +msgid "ID" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_res_config_settings____last_update +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking____last_update +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table____last_update +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__write_uid +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__write_uid +msgid "Last Updated by" +msgstr "Dernière modification par" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__write_date +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__name +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__name +msgid "Name" +msgstr "Nom" + +#. module: pos_restaurant_table_booking +#: model:ir.actions.act_window,name:pos_restaurant_table_booking.create_new_booking_act_window +#: model:ir.ui.menu,name:pos_restaurant_table_booking.restaurant_new_booking_menu +msgid "New booking" +msgstr "Nouvelle réservation" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Next saturday" +msgstr "Samedi prochain" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Next sunday" +msgstr "Dimanche prochain" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Next wednesday" +msgstr "Mercredi prochain" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Next week" +msgstr "Semaine prochaine" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__count +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__count +msgid "People count" +msgstr "Effectif" + +#. module: pos_restaurant_table_booking +#: model:ir.model,name:pos_restaurant_table_booking.model_restaurant_table_booking +msgid "Resaturant table booking" +msgstr "Réservation de table (restaurant)" + +#. module: pos_restaurant_table_booking +#: model:ir.model,name:pos_restaurant_table_booking.model_restaurant_table +msgid "Restaurant Table" +msgstr "Table de restaurant" + +#. module: pos_restaurant_table_booking +#: model:ir.model,name:pos_restaurant_table_booking.model_restaurant_booking +msgid "Restaurant booking" +msgstr "Réservation (restaurant)" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table__bookable +msgid "Bookable" +msgstr "Réservable" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__booking_id +msgid "Booking" +msgstr "Réservation" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.actions.act_window,help:pos_restaurant_table_booking.restaurant_booking_act_window +msgid "Schedule a new booking." +msgstr "Programmer une nouvelle réservation" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__time_start +msgid "Start" +msgstr "Début" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__time_stop +msgid "Stop" +msgstr "Fin" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__table_id +msgid "Table" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__table_ids +msgid "Tables" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.actions.act_window,name:pos_restaurant_table_booking.restaurant_table_booking_act_window +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__table_booking_ids +#: model:ir.ui.menu,name:pos_restaurant_table_booking.restaurant_table_booking_menu +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Tables bookings" +msgstr "Réservations des tables" + +#. module: pos_restaurant_table_booking +#: model:ir.model.constraint,message:pos_restaurant_table_booking.constraint_res_config_settings_duration_positive +msgid "The default booking duration must be positive or null." +msgstr "La durée dee réservation par défaut doit êetre positive ou nulle." + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,help:pos_restaurant_table_booking.field_restaurant_table_booking__color +msgid "" +"The table's color, expressed as a valid 'background' CSS property value" +msgstr "" +"La couleur de la table, exprimée dans une valeur d'arrière-plan CSS correcte" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.res_config_settings_form +msgid "" +"This duration is applied to any new booking created in the point of sale." +msgstr "" +"Cette duréee sera appliquée aux nouvelles réservations créées." + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "This week" +msgstr "Cette semaine" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_form +msgid "Times" +msgstr "Horaires" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.actions.act_window,help:pos_restaurant_table_booking.restaurant_booking_act_window +msgid "" +"To book, you must provide a name, a date, start and stop hours, the people " +"count and one or more tables." +msgstr "" +"Pour réserver, vous devez fournir un nom, une date, des horaires, l'effectif du groupe " +"et une ou plusieurs tables." + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Today" +msgstr "Aujourd'hui" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Tomorrow" +msgstr "Demain" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Upcoming" +msgstr "À venir" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "hours" +msgstr "heures" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "pers." +msgstr "" diff --git a/pos_restaurant_table_booking/i18n/pos_restaurant_table_booking.pot b/pos_restaurant_table_booking/i18n/pos_restaurant_table_booking.pot new file mode 100644 index 0000000..e949699 --- /dev/null +++ b/pos_restaurant_table_booking/i18n/pos_restaurant_table_booking.pot @@ -0,0 +1,332 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_restaurant_table_booking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-26 14:00+0000\n" +"PO-Revision-Date: 2020-10-26 14:00+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_form +msgid "" +"\n" +" Le nombre de places cumulé des tables sélectionnées est inférieur à l'effectif." +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_form +msgid "from" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_form +msgid "to" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Durée : " +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Début : " +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Effectif : " +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Fin : " +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.actions.act_window,name:pos_restaurant_table_booking.restaurant_booking_act_window +#: model:ir.ui.menu,name:pos_restaurant_table_booking.restaurant_booking_menu +msgid "All bookings" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__available_table_ids +msgid "Available tables" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.ui.menu,name:pos_restaurant_table_booking.restaurant_booking_root_menu +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.res_config_settings_form +msgid "Bookings" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__table_capacity +msgid "Capacity" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__table_capacity_ok +msgid "Capacity OK" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__color +msgid "Color" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model,name:pos_restaurant_table_booking.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__create_uid +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__create_uid +msgid "Created by" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__create_date +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__create_date +msgid "Created on" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__date +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Date" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__datetime_start +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__datetime_start +msgid "Date début" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__datetime_stop +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__datetime_stop +msgid "Date fin" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_res_config_settings__default_duration +msgid "Default duration" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__display_name +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table__display_name +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__display_name +msgid "Display Name" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__duration +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__duration +msgid "Duration" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Filters" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Group By" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_res_config_settings__id +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__id +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table__id +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__id +msgid "ID" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_res_config_settings____last_update +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking____last_update +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table____last_update +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__write_uid +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__write_date +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__write_date +msgid "Last Updated on" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__name +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__name +msgid "Name" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.actions.act_window,name:pos_restaurant_table_booking.create_new_booking_act_window +#: model:ir.ui.menu,name:pos_restaurant_table_booking.restaurant_new_booking_menu +msgid "New booking" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Next saturday" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Next sunday" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Next wednesday" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Next week" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__count +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__count +msgid "People count" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model,name:pos_restaurant_table_booking.model_restaurant_table_booking +msgid "Resaturant table booking" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model,name:pos_restaurant_table_booking.model_restaurant_table +msgid "Restaurant Table" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model,name:pos_restaurant_table_booking.model_restaurant_booking +msgid "Restaurant booking" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table__bookable +msgid "Réservable" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__booking_id +msgid "Réservation" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.actions.act_window,help:pos_restaurant_table_booking.restaurant_booking_act_window +msgid "Schedule a new booking." +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__time_start +msgid "Start" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__time_stop +msgid "Stop" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_table_booking__table_id +msgid "Table" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__table_ids +msgid "Tables" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.actions.act_window,name:pos_restaurant_table_booking.restaurant_table_booking_act_window +#: model:ir.model.fields,field_description:pos_restaurant_table_booking.field_restaurant_booking__table_booking_ids +#: model:ir.ui.menu,name:pos_restaurant_table_booking.restaurant_table_booking_menu +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "Tables bookings" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.constraint,message:pos_restaurant_table_booking.constraint_res_config_settings_duration_positive +msgid "The default booking duration must be positive or null." +msgstr "" + +#. module: pos_restaurant_table_booking +#: model:ir.model.fields,help:pos_restaurant_table_booking.field_restaurant_table_booking__color +msgid "" +"The table's color, expressed as a valid 'background' CSS property value" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.res_config_settings_form +msgid "" +"This duration is applied to any new booking created in the point of sale." +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "This week" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_form +msgid "Times" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.actions.act_window,help:pos_restaurant_table_booking.restaurant_booking_act_window +msgid "" +"To book, you must provide a name, a date, start and stop hours, the people " +"count and one or more tables." +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Today" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Tomorrow" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_booking_search +msgid "Upcoming" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "heures" +msgstr "" + +#. module: pos_restaurant_table_booking +#: model_terms:ir.ui.view,arch_db:pos_restaurant_table_booking.restaurant_table_booking_gantt +msgid "pers." +msgstr "" diff --git a/pos_restaurant_table_booking/models/__init__.py b/pos_restaurant_table_booking/models/__init__.py new file mode 100644 index 0000000..d523e04 --- /dev/null +++ b/pos_restaurant_table_booking/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +from . import res_config_settings +from . import restaurant_booking +from . import restaurant_table_booking +from . import restaurant_table diff --git a/pos_restaurant_table_booking/models/__pycache__/__init__.cpython-37.pyc b/pos_restaurant_table_booking/models/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7a18f96e0d858523e95edbcc87ad932ec6290663 GIT binary patch literal 312 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 UC>OS0qSwgdNdrl%q1A`}3nIA0I{*Lx literal 0 HcmV?d00001 diff --git a/pos_restaurant_table_booking/models/__pycache__/restaurant_table.cpython-37.pyc b/pos_restaurant_table_booking/models/__pycache__/restaurant_table.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..656f24afe7320a1db2ccd02ed8b339e198645d3d GIT binary patch literal 712 zcmZ8fJ#W-N5S?AGeU?SY(NSK7;^r(-BZLA1QE){-Lb8Nbo6O$D7k|a;lfrRVk(QP^ zDfvfeTPpqn6*CSO0wc|McV_%{-rGIg+e?5f`uDv^sy z=2E~bK#9R6U|_{E_#EU4)muozpVSMf^ikEIEuD|%g)PyYaC&F|09(ifLM~C{fmO?p zVNrdNd4wTGmynNeM8L7%KeDbjtIpK@J9Avx^|-rDOnc7c@nO@P@#-Z{;QFqp7k-3x zZdPS~Li`2`D8}T^$=zcL3)qT_gAKfZ50kCjh%4C0r9g2d=^K!%YdM$KLcn?Q9yWr; zk+XI3X*)R}Z>MP*`pC4ct?JwaePZ>A&>!(5{b(9Wlyoq|N@XPuq_^<|FmO_I$05S%Od^5fia~ zcyue*px<=YIwNsot%t4liPnU_Dy`Q3p4R6pQ~s&Mx~NZWSM(h#=tm@WX-(~8o{LrQ z9#DRubSI2C$2T65yNE(8l)Nv8+>De{%)67^HsFSD_~i`cJ1{I%$5=joax>pk{>5<^ G2fqPCVYn^; literal 0 HcmV?d00001 diff --git a/pos_restaurant_table_booking/models/__pycache__/restaurant_table_booking.cpython-37.pyc b/pos_restaurant_table_booking/models/__pycache__/restaurant_table_booking.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..947a3a233b3a704641a76fe6855593a02b72db8b GIT binary patch literal 1072 zcmZ`&OK;RL5O&__c3<5VDB`kQK#{7h#2KNgAP|RE0(#2DN;9TS$;PSUJv3K1vRD2C z{|L>M6Mumd<0MN{32b>ZpXcG3&-U?XG+;Cy{rJX9hq0dqY=%q95v}S831DF5Y-z>T z(vEG5yI3jL3n$e~Kj_Gb8`9MP)2k`OGm zfW&@xabi#SR{^--fe!(MYc~#QXA8Cn57u@(AhZqJ9U2lE!LUQ)28}v2AvA?C zOx9MsLwW#H*dg0&?Zh*}Td>=C?!q3Ge-9tL7nM#{Dk=0?a-Iu*F6F1JxTyElU&Eok zYoU-tHzD)JGT+2Jg+vRTEd{5XN*~O7Se6H^H_xD+^^$kNad6z8e1<`qRA~Yta&ef- zhFD%COM!l+71f5J64$Ft3BXVmM7z+Uo^*LA{h@KDI|-D?sUSeF(o%_f+H*7;c&{si=$ZOwCP) zM*M!axRgt=kRatE0gy$tC}qWO8RBhpSLLGpL5u&{56c^6zNkm5x=$jsTr=&NHSXrn qnp%y|Y2=}64puffw!C;J=7%=s+ag=-F*#xQyrukw38{>jI)4D4X-UBV literal 0 HcmV?d00001 diff --git a/pos_restaurant_table_booking/models/res_config_settings.py b/pos_restaurant_table_booking/models/res_config_settings.py new file mode 100644 index 0000000..9d5f886 --- /dev/null +++ b/pos_restaurant_table_booking/models/res_config_settings.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + default_duration = fields.Float(string="Default duration", default_model='restaurant.booking') + + _sql_constraints = [ + ('duration_positive', 'CHECK(default_duration >= 0)', "The default booking duration must be positive or null.") + ] diff --git a/pos_restaurant_table_booking/models/restaurant_booking.py b/pos_restaurant_table_booking/models/restaurant_booking.py new file mode 100644 index 0000000..eb2de61 --- /dev/null +++ b/pos_restaurant_table_booking/models/restaurant_booking.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +from datetime import datetime as dtdatetime, time as dttime +from odoo import models, fields, api +from pytz import timezone, utc + +def float2time(fhours, seconds=False): + hrs = int(fhours) + fmin = (fhours - hrs) * 60 + min = int(fmin) + sec = 0 + if seconds: + fsec = (fmin - min) * 60 + sec = int(fsec) + return dttime(hrs, min, sec) + + +class RestaurantBooking(models.Model): + _name = 'restaurant.booking' + _description = "Restaurant booking" + _order = 'date, time_start, count desc' + + @api.model + def default_get(self, fields_list): + defaults = super().default_get(fields_list) + start = self.env.context.get('default_datetime_start', False) + table_id = self.env.context.get('default_table_id', False) + if start: + defaults['date'] = start[:10] + dtstart = fields.Datetime.context_timestamp(self, fields.Datetime.to_datetime(start)) + tstart = dtstart.hour + if tstart: + defaults['time_start'] = tstart + if table_id: + defaults['table_ids'] = [(6, 0, [table_id])] + return defaults + + name = fields.Char(string="Name", required=True) + date = fields.Date(string="Date", required=True) + time_start = fields.Float(string="Start", required=True, group_operator=False) + time_stop = fields.Float(string="Stop", compute="_get_time_stop", store=True, inverse="_set_time_stop", + required=True, group_operator=False) + duration = fields.Float(string="Duration", required=True, group_operator=False) + datetime_start = fields.Datetime(string="Date start", compute="_get_datetimes", store=True) + datetime_stop = fields.Datetime(string="Date stop", compute="_get_datetimes", store=True) + count = fields.Integer(string="People count", required=True) + available_table_ids = fields.Many2many(comodel_name='restaurant.table', string="Available tables", + column1="booking_id", column2="table_id", relation="booking_available_table_rel", + compute="_get_available_tables") + table_ids = fields.Many2many(comodel_name='restaurant.table', string="Tables", required=True, + column1="booking_id", column2="table_id", relation="booking_table_rel", + domain="[('id', 'in', available_table_ids)]") + table_capacity = fields.Integer(string="Capacity", compute="_get_table_capacity") + table_capacity_ok = fields.Boolean(string="Capacity OK", compute="_check_table_capacity") + table_booking_ids = fields.One2many(comodel_name="restaurant.table_booking", inverse_name="booking_id", + string="Tables bookings", readonly=True) + + @api.depends('time_start', 'duration') + def _get_time_stop(self): + for booking in self: + if booking.time_start and booking.duration: + booking.time_stop = booking.time_start + booking.duration + else: + booking.time_stop = 0.0 + + @api.onchange('time_stop') + def _set_time_stop(self): + for booking in self: + stop = booking.time_stop + if stop: + booking.duration = stop - booking.time_start + + @api.depends('date', 'time_start', 'time_stop') + def _get_datetimes(self): + user_tz = timezone(self.env.user.tz) + for booking in self: + date = booking.date + if date and booking.time_start: + dt_start = user_tz.localize(dtdatetime.combine(date, float2time(booking.time_start))) + booking.datetime_start = dt_start.astimezone(utc).replace(tzinfo=None) + else: + booking.datetime_start = False + if date and booking.time_stop: + dt_stop = user_tz.localize(dtdatetime.combine(date, float2time(booking.time_stop))) + booking.datetime_stop = dt_stop.astimezone(utc).replace(tzinfo=None) + else: + booking.datetime_stop = False + + @api.depends('table_ids') + def _get_table_capacity(self): + for booking in self: + booking.table_capacity = sum(booking.table_ids.mapped('seats')) + + @api.depends('table_capacity', 'count') + def _check_table_capacity(self): + for booking in self: + booking.table_capacity_ok = bool(booking.table_capacity >= booking.count) + + @api.depends('datetime_start', 'datetime_stop', 'table_ids') + def _get_available_tables(self): + Table = self.env['restaurant.table'] + TableBooking = self.env['restaurant.table_booking'] + for booking in self: + if booking.datetime_start and booking.datetime_stop: + tbookings = TableBooking.search([ + '|', '&', ('datetime_start', '<', booking.datetime_stop), + ('datetime_start', '>=', booking.datetime_start), + '&', ('datetime_stop', '>', booking.datetime_start), + ('datetime_stop', '<=', booking.datetime_stop) + ]) + booking.available_table_ids = Table.search([ + ('bookable', '=', True), + ('id', 'not in', tbookings.mapped('table_id').ids), + ]) - booking.table_ids + else: + booking.available_table_ids = [(5, 0, 0)] + + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + vals.update({ + 'table_booking_ids': [(0, 0, {'table_id': table_id}) for table_id in vals['table_ids'][0][2]] + }) + res = super().create(vals_list) + return res + + def write(self, vals): + res = super().write(vals) + TableBooking = self.env['restaurant.table_booking'] + to_unlink = TableBooking + for booking in self: + tables = booking.table_ids + table_bookings = booking.table_booking_ids + delete = table_bookings.filtered(lambda rtb: rtb.table_id not in tables) + to_unlink |= delete + to_create = tables - (table_bookings - delete).mapped('table_id') + if to_create: + TableBooking.create([{ + 'booking_id': booking.id, + 'table_id': table.id, + } for table in to_create]) + if to_unlink: + to_unlink.unlink() + return res diff --git a/pos_restaurant_table_booking/models/restaurant_table.py b/pos_restaurant_table_booking/models/restaurant_table.py new file mode 100644 index 0000000..ab2de0d --- /dev/null +++ b/pos_restaurant_table_booking/models/restaurant_table.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields + + +class RestaurantTable(models.Model): + _inherit = 'restaurant.table' + + bookable = fields.Boolean(string="Bookable", default=False) + + def name_get(self): + res = [] + for table in self: + res.append((table.id, "{} ({} p.)".format(table.name, table.seats))) + return res diff --git a/pos_restaurant_table_booking/models/restaurant_table_booking.py b/pos_restaurant_table_booking/models/restaurant_table_booking.py new file mode 100644 index 0000000..76caf47 --- /dev/null +++ b/pos_restaurant_table_booking/models/restaurant_table_booking.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields + + +class RestaurantTable_booking(models.Model): + _name = 'restaurant.table_booking' + _description = "Resaturant table booking" + _order = 'datetime_start, datetime_stop, table_id' + + booking_id = fields.Many2one(comodel_name='restaurant.booking', string="Booking", required=True, ondelete='cascade') + name = fields.Char(related='booking_id.name', store=True) + count = fields.Integer(related='booking_id.count', store=True) + datetime_start = fields.Datetime(related='booking_id.datetime_start', store=True) + datetime_stop = fields.Datetime(related='booking_id.datetime_stop', store=True) + duration = fields.Float(related='booking_id.duration') + table_id = fields.Many2one(comodel_name='restaurant.table', string="Table", required=True) + color = fields.Char(related='table_id.color', store=True) diff --git a/pos_restaurant_table_booking/security/ir_model_access.xml b/pos_restaurant_table_booking/security/ir_model_access.xml new file mode 100644 index 0000000..a418436 --- /dev/null +++ b/pos_restaurant_table_booking/security/ir_model_access.xml @@ -0,0 +1,24 @@ + + + + + Booking restaurant.booking PoS user + + + 1 + 1 + 1 + 1 + + + + Booking restaurant.table_booking PoS user + + + 1 + 1 + 1 + 1 + + + diff --git a/pos_restaurant_table_booking/views/res_config_settings.xml b/pos_restaurant_table_booking/views/res_config_settings.xml new file mode 100644 index 0000000..6f997cf --- /dev/null +++ b/pos_restaurant_table_booking/views/res_config_settings.xml @@ -0,0 +1,30 @@ + + + + + Booking res.config.settings form + res.config.settings + + + +

Bookings

+
+
+
+
+
+
+
+
+
+
+
+ +
diff --git a/pos_restaurant_table_booking/views/restaurant_booking.xml b/pos_restaurant_table_booking/views/restaurant_booking.xml new file mode 100644 index 0000000..27d180c --- /dev/null +++ b/pos_restaurant_table_booking/views/restaurant_booking.xml @@ -0,0 +1,137 @@ + + + + + Booking restaurant.booking form + restaurant.booking + +
+ +
+
+ + + + + + + + + + + + + +
+ +
+
+ + + Booking restaurant.booking tree + restaurant.booking + + + + + + + + + + + + + + + + Booking restaurant.booking search + restaurant.booking + + + + + + + + + + + + + + + + + + + + + + + + + + All bookings + restaurant.booking + tree,form + {'search_default_upcoming':1, 'search_default_this_week':1, 'search_default_by_date':1} + +

+ Schedule a new booking. +

+ To book, you must provide a name, a date, start and stop hours, the people count and one or more tables. +

+
+
+ + + New booking + ir.actions.act_window + restaurant.booking + + new + + + + + + + + +
diff --git a/pos_restaurant_table_booking/views/restaurant_floor.xml b/pos_restaurant_table_booking/views/restaurant_floor.xml new file mode 100644 index 0000000..6ba234f --- /dev/null +++ b/pos_restaurant_table_booking/views/restaurant_floor.xml @@ -0,0 +1,29 @@ + + + + + Booking restaurant.floor form + restaurant.floor + + + + + + + + + + + + + diff --git a/pos_restaurant_table_booking/views/restaurant_table.xml b/pos_restaurant_table_booking/views/restaurant_table.xml new file mode 100644 index 0000000..c58a3be --- /dev/null +++ b/pos_restaurant_table_booking/views/restaurant_table.xml @@ -0,0 +1,29 @@ + + + + + Booking restaurant.table form + restaurant.table + + + + + + + + + + + + + diff --git a/pos_restaurant_table_booking/views/restaurant_table_booking.xml b/pos_restaurant_table_booking/views/restaurant_table_booking.xml new file mode 100644 index 0000000..e95c28b --- /dev/null +++ b/pos_restaurant_table_booking/views/restaurant_table_booking.xml @@ -0,0 +1,103 @@ + + + + + Booking restaurant.table_booking form + restaurant.table_booking + +
+ + + + + + + + + + + + + +
+
+
+ + + Booking restaurant.table_booking tree + restaurant.table_booking + + + + + + + + + + + + + Booking restaurant.table_booking gantt + restaurant.table_booking + + + + + + + +
+
+
+
    +
  • Start :
  • +
  • Stop :
  • +
  • Duration : hours
  • +
  • People count : pers.
  • +
+
+
+
+
+
+
+
+ + + Booking restaurant.table_booking search + restaurant.table_booking + + + + + + + + + + + Tables bookings + restaurant.table_booking + gantt,form + + + + + + +