├── .gitignore ├── MANIFEST.in ├── README.md ├── hospitality ├── __init__.py ├── config │ ├── __init__.py │ ├── desktop.py │ └── docs.py ├── hooks.py ├── hospitality │ ├── __init__.py │ ├── doctype │ │ ├── __init__.py │ │ ├── hotel_room │ │ │ ├── __init__.py │ │ │ ├── hotel_room.js │ │ │ ├── hotel_room.json │ │ │ ├── hotel_room.py │ │ │ └── test_hotel_room.py │ │ ├── hotel_room_amenity │ │ │ ├── __init__.py │ │ │ ├── hotel_room_amenity.json │ │ │ └── hotel_room_amenity.py │ │ ├── hotel_room_package │ │ │ ├── __init__.py │ │ │ ├── hotel_room_package.js │ │ │ ├── hotel_room_package.json │ │ │ ├── hotel_room_package.py │ │ │ └── test_hotel_room_package.py │ │ ├── hotel_room_pricing │ │ │ ├── __init__.py │ │ │ ├── hotel_room_pricing.js │ │ │ ├── hotel_room_pricing.json │ │ │ ├── hotel_room_pricing.py │ │ │ └── test_hotel_room_pricing.py │ │ ├── hotel_room_pricing_item │ │ │ ├── __init__.py │ │ │ ├── hotel_room_pricing_item.json │ │ │ └── hotel_room_pricing_item.py │ │ ├── hotel_room_pricing_package │ │ │ ├── __init__.py │ │ │ ├── hotel_room_pricing_package.js │ │ │ ├── hotel_room_pricing_package.json │ │ │ ├── hotel_room_pricing_package.py │ │ │ └── test_hotel_room_pricing_package.py │ │ ├── hotel_room_reservation │ │ │ ├── __init__.py │ │ │ ├── hotel_room_reservation.js │ │ │ ├── hotel_room_reservation.json │ │ │ ├── hotel_room_reservation.py │ │ │ ├── hotel_room_reservation_calendar.js │ │ │ └── test_hotel_room_reservation.py │ │ ├── hotel_room_reservation_item │ │ │ ├── __init__.py │ │ │ ├── hotel_room_reservation_item.json │ │ │ └── hotel_room_reservation_item.py │ │ ├── hotel_room_type │ │ │ ├── __init__.py │ │ │ ├── hotel_room_type.js │ │ │ ├── hotel_room_type.json │ │ │ ├── hotel_room_type.py │ │ │ └── test_hotel_room_type.py │ │ └── hotel_settings │ │ │ ├── __init__.py │ │ │ ├── hotel_settings.js │ │ │ ├── hotel_settings.json │ │ │ ├── hotel_settings.py │ │ │ └── test_hotel_settings.py │ ├── hospitality.py │ └── report │ │ ├── __init__.py │ │ └── hotel_room_occupancy │ │ ├── __init__.py │ │ ├── hotel_room_occupancy.js │ │ ├── hotel_room_occupancy.json │ │ └── hotel_room_occupancy.py ├── hotels │ ├── __init__.py │ ├── doctype │ │ ├── __init__.py │ │ ├── hotel_room │ │ │ ├── __init__.py │ │ │ ├── hotel_room.js │ │ │ ├── hotel_room.json │ │ │ ├── hotel_room.py │ │ │ └── test_hotel_room.py │ │ ├── hotel_room_amenity │ │ │ ├── __init__.py │ │ │ ├── hotel_room_amenity.json │ │ │ └── hotel_room_amenity.py │ │ ├── hotel_room_package │ │ │ ├── __init__.py │ │ │ ├── hotel_room_package.js │ │ │ ├── hotel_room_package.json │ │ │ ├── hotel_room_package.py │ │ │ └── test_hotel_room_package.py │ │ ├── hotel_room_pricing │ │ │ ├── __init__.py │ │ │ ├── hotel_room_pricing.js │ │ │ ├── hotel_room_pricing.json │ │ │ ├── hotel_room_pricing.py │ │ │ └── test_hotel_room_pricing.py │ │ ├── hotel_room_pricing_item │ │ │ ├── __init__.py │ │ │ ├── hotel_room_pricing_item.json │ │ │ └── hotel_room_pricing_item.py │ │ ├── hotel_room_pricing_package │ │ │ ├── __init__.py │ │ │ ├── hotel_room_pricing_package.js │ │ │ ├── hotel_room_pricing_package.json │ │ │ ├── hotel_room_pricing_package.py │ │ │ └── test_hotel_room_pricing_package.py │ │ ├── hotel_room_reservation │ │ │ ├── __init__.py │ │ │ ├── hotel_room_reservation.js │ │ │ ├── hotel_room_reservation.json │ │ │ ├── hotel_room_reservation.py │ │ │ ├── hotel_room_reservation_calendar.js │ │ │ └── test_hotel_room_reservation.py │ │ ├── hotel_room_reservation_item │ │ │ ├── __init__.py │ │ │ ├── hotel_room_reservation_item.json │ │ │ └── hotel_room_reservation_item.py │ │ ├── hotel_room_type │ │ │ ├── __init__.py │ │ │ ├── hotel_room_type.js │ │ │ ├── hotel_room_type.json │ │ │ ├── hotel_room_type.py │ │ │ └── test_hotel_room_type.py │ │ └── hotel_settings │ │ │ ├── __init__.py │ │ │ ├── hotel_settings.js │ │ │ ├── hotel_settings.json │ │ │ ├── hotel_settings.py │ │ │ └── test_hotel_settings.py │ └── report │ │ ├── __init__.py │ │ └── hotel_room_occupancy │ │ ├── __init__.py │ │ ├── hotel_room_occupancy.js │ │ ├── hotel_room_occupancy.json │ │ └── hotel_room_occupancy.py ├── modules.txt ├── patches.txt ├── restaurant │ ├── __init__.py │ └── doctype │ │ ├── __init__.py │ │ ├── restaurant │ │ ├── __init__.py │ │ ├── restaurant.js │ │ ├── restaurant.json │ │ ├── restaurant.py │ │ ├── restaurant_dashboard.py │ │ └── test_restaurant.py │ │ ├── restaurant_menu │ │ ├── __init__.py │ │ ├── restaurant_menu.js │ │ ├── restaurant_menu.json │ │ ├── restaurant_menu.py │ │ └── test_restaurant_menu.py │ │ ├── restaurant_menu_item │ │ ├── __init__.py │ │ ├── restaurant_menu_item.json │ │ └── restaurant_menu_item.py │ │ ├── restaurant_order_entry │ │ ├── __init__.py │ │ ├── restaurant_order_entry.js │ │ ├── restaurant_order_entry.json │ │ └── restaurant_order_entry.py │ │ ├── restaurant_order_entry_item │ │ ├── __init__.py │ │ ├── restaurant_order_entry_item.json │ │ └── restaurant_order_entry_item.py │ │ ├── restaurant_reservation │ │ ├── __init__.py │ │ ├── restaurant_reservation.js │ │ ├── restaurant_reservation.json │ │ ├── restaurant_reservation.py │ │ ├── restaurant_reservation_calendar.js │ │ └── test_restaurant_reservation.py │ │ └── restaurant_table │ │ ├── __init__.py │ │ ├── restaurant_table.js │ │ ├── restaurant_table.json │ │ ├── restaurant_table.py │ │ └── test_restaurant_table.py └── templates │ ├── __init__.py │ └── pages │ └── __init__.py ├── license.txt ├── requirements.txt └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pyc 3 | *.egg-info 4 | *.swp 5 | tags 6 | hospitality/docs/current -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include MANIFEST.in 2 | include requirements.txt 3 | include *.json 4 | include *.md 5 | include *.py 6 | include *.txt 7 | recursive-include hospitality *.css 8 | recursive-include hospitality *.csv 9 | recursive-include hospitality *.html 10 | recursive-include hospitality *.ico 11 | recursive-include hospitality *.js 12 | recursive-include hospitality *.json 13 | recursive-include hospitality *.md 14 | recursive-include hospitality *.png 15 | recursive-include hospitality *.py 16 | recursive-include hospitality *.svg 17 | recursive-include hospitality *.txt 18 | recursive-exclude hospitality *.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Hospitality 2 | 3 | ERPNext Hospitality module is designed to handle workflows for Hotels and Restaurants. 4 | 5 | 6 | #### Manage Restaurants 7 | 8 | The Restaurant module in ERPNext will help you manage a chain of restaurants. You can create Restaurants, Menus, Tables, Reservations and a manage Order Entry and Billing. 9 | 10 | #### Manage Hotels 11 | 12 | The Hotels module in ERPNext will help you manage creating Hotel Rooms, create Hotel Room Reservation. It will also help in creating Invoice from hotel room reservation. 13 | 14 | 15 | ### Installation 16 | 17 | Using bench, [install ERPNext](https://github.com/frappe/bench#installation) as mentioned here. 18 | 19 | Once ERPNext is installed, add healthcare app to your bench by running 20 | 21 | ```sh 22 | $ bench get-app hospitality 23 | ``` 24 | 25 | After that, you can install non_profit app on required site by running 26 | 27 | ```sh 28 | $ bench --site demo.com install-app hospitality 29 | ``` 30 | 31 | 32 | ### Documentation 33 | 34 | Read documentation at https://docs.erpnext.com/docs/v13/user/manual/en/hospitality 35 | 36 | 37 | ### License 38 | 39 | GNU GPL V3 40 | -------------------------------------------------------------------------------- /hospitality/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | __version__ = '0.0.1' 3 | 4 | -------------------------------------------------------------------------------- /hospitality/config/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/config/__init__.py -------------------------------------------------------------------------------- /hospitality/config/desktop.py: -------------------------------------------------------------------------------- 1 | from frappe import _ 2 | 3 | def get_data(): 4 | return [ 5 | { 6 | "module_name": "Hospitality", 7 | "color": "grey", 8 | "icon": "octicon octicon-file-directory", 9 | "type": "module", 10 | "label": _("Hospitality") 11 | } 12 | ] 13 | -------------------------------------------------------------------------------- /hospitality/config/docs.py: -------------------------------------------------------------------------------- 1 | """ 2 | Configuration for docs 3 | """ 4 | 5 | # source_link = "https://github.com/[org_name]/hospitality" 6 | # headline = "App that does everything" 7 | # sub_heading = "Yes, you got that right the first time, everything" 8 | 9 | def get_context(context): 10 | context.brand_html = "Hospitality" 11 | -------------------------------------------------------------------------------- /hospitality/hooks.py: -------------------------------------------------------------------------------- 1 | from . import __version__ as app_version 2 | 3 | app_name = "hospitality" 4 | app_title = "Hospitality" 5 | app_publisher = "Frappe" 6 | app_description = "Hospitality" 7 | app_icon = "octicon octicon-file-directory" 8 | app_color = "grey" 9 | app_email = "pandikunta@frappe.io" 10 | app_license = "MIT" 11 | 12 | required_apps = ["erpnext"] 13 | 14 | 15 | # Includes in 16 | # ------------------ 17 | 18 | # include js, css files in header of desk.html 19 | # app_include_css = "/assets/hospitality/css/hospitality.css" 20 | # app_include_js = "/assets/hospitality/js/hospitality.js" 21 | 22 | # include js, css files in header of web template 23 | # web_include_css = "/assets/hospitality/css/hospitality.css" 24 | # web_include_js = "/assets/hospitality/js/hospitality.js" 25 | 26 | # include custom scss in every website theme (without file extension ".scss") 27 | # website_theme_scss = "hospitality/public/scss/website" 28 | 29 | # include js, css files in header of web form 30 | # webform_include_js = {"doctype": "public/js/doctype.js"} 31 | # webform_include_css = {"doctype": "public/css/doctype.css"} 32 | 33 | # include js in page 34 | # page_js = {"page" : "public/js/file.js"} 35 | 36 | # include js in doctype views 37 | # doctype_js = {"doctype" : "public/js/doctype.js"} 38 | # doctype_list_js = {"doctype" : "public/js/doctype_list.js"} 39 | # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} 40 | # doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"} 41 | 42 | # Home Pages 43 | # ---------- 44 | 45 | # application home page (will override Website Settings) 46 | # home_page = "login" 47 | 48 | # website user home page (by Role) 49 | # role_home_page = { 50 | # "Role": "home_page" 51 | # } 52 | 53 | # Generators 54 | # ---------- 55 | 56 | # automatically create page for each record of this doctype 57 | # website_generators = ["Web Page"] 58 | 59 | # Jinja 60 | # ---------- 61 | 62 | # add methods and filters to jinja environment 63 | # jinja = { 64 | # "methods": "hospitality.utils.jinja_methods", 65 | # "filters": "hospitality.utils.jinja_filters" 66 | # } 67 | 68 | # Installation 69 | # ------------ 70 | 71 | # before_install = "hospitality.install.before_install" 72 | # after_install = "hospitality.install.after_install" 73 | 74 | # Uninstallation 75 | # ------------ 76 | 77 | # before_uninstall = "hospitality.uninstall.before_uninstall" 78 | # after_uninstall = "hospitality.uninstall.after_uninstall" 79 | 80 | # Desk Notifications 81 | # ------------------ 82 | # See frappe.core.notifications.get_notification_config 83 | 84 | # notification_config = "hospitality.notifications.get_notification_config" 85 | 86 | # Permissions 87 | # ----------- 88 | # Permissions evaluated in scripted ways 89 | 90 | # permission_query_conditions = { 91 | # "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", 92 | # } 93 | # 94 | # has_permission = { 95 | # "Event": "frappe.desk.doctype.event.event.has_permission", 96 | # } 97 | 98 | # DocType Class 99 | # --------------- 100 | # Override standard doctype classes 101 | 102 | # override_doctype_class = { 103 | # "ToDo": "custom_app.overrides.CustomToDo" 104 | # } 105 | 106 | # Document Events 107 | # --------------- 108 | # Hook on document methods and events 109 | 110 | # doc_events = { 111 | # "*": { 112 | # "on_update": "method", 113 | # "on_cancel": "method", 114 | # "on_trash": "method" 115 | # } 116 | # } 117 | 118 | # Scheduled Tasks 119 | # --------------- 120 | 121 | # scheduler_events = { 122 | # "all": [ 123 | # "hospitality.tasks.all" 124 | # ], 125 | # "daily": [ 126 | # "hospitality.tasks.daily" 127 | # ], 128 | # "hourly": [ 129 | # "hospitality.tasks.hourly" 130 | # ], 131 | # "weekly": [ 132 | # "hospitality.tasks.weekly" 133 | # ], 134 | # "monthly": [ 135 | # "hospitality.tasks.monthly" 136 | # ], 137 | # } 138 | 139 | # Testing 140 | # ------- 141 | 142 | # before_tests = "hospitality.install.before_tests" 143 | 144 | # Overriding Methods 145 | # ------------------------------ 146 | # 147 | # override_whitelisted_methods = { 148 | # "frappe.desk.doctype.event.event.get_events": "hospitality.event.get_events" 149 | # } 150 | # 151 | # each overriding function accepts a `data` argument; 152 | # generated from the base implementation of the doctype dashboard, 153 | # along with any modifications made in other Frappe apps 154 | # override_doctype_dashboards = { 155 | # "Task": "hospitality.task.get_dashboard_data" 156 | # } 157 | 158 | # exempt linked doctypes from being automatically cancelled 159 | # 160 | # auto_cancel_exempted_doctypes = ["Auto Repeat"] 161 | 162 | 163 | # User Data Protection 164 | # -------------------- 165 | 166 | # user_data_fields = [ 167 | # { 168 | # "doctype": "{doctype_1}", 169 | # "filter_by": "{filter_by}", 170 | # "redact_fields": ["{field_1}", "{field_2}"], 171 | # "partial": 1, 172 | # }, 173 | # { 174 | # "doctype": "{doctype_2}", 175 | # "filter_by": "{filter_by}", 176 | # "partial": 1, 177 | # }, 178 | # { 179 | # "doctype": "{doctype_3}", 180 | # "strict": False, 181 | # }, 182 | # { 183 | # "doctype": "{doctype_4}" 184 | # } 185 | # ] 186 | 187 | # Authentication and authorization 188 | # -------------------------------- 189 | 190 | # auth_hooks = [ 191 | # "hospitality.auth.validate" 192 | # ] 193 | 194 | global_search_doctypes = { 195 | "Hospitality": [ 196 | {'doctype': 'Hotel Room', 'index': 0}, 197 | {'doctype': 'Hotel Room Reservation', 'index': 1}, 198 | {'doctype': 'Hotel Room Pricing', 'index': 2}, 199 | {'doctype': 'Hotel Room Package', 'index': 3}, 200 | {'doctype': 'Hotel Room Type', 'index': 4} 201 | ] 202 | } 203 | 204 | domains = { 205 | 'Hospitality': 'hospitality.hospitality.hospitality', 206 | } 207 | -------------------------------------------------------------------------------- /hospitality/hospitality/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room/hotel_room.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room/hotel_room.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 1, 5 | "allow_rename": 1, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-12-08 12:33:56.320420", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "hotel_room_type", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 1, 30 | "in_standard_filter": 0, 31 | "label": "Hotel Room Type", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Hotel Room Type", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "capacity", 54 | "fieldtype": "Int", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 1, 61 | "in_standard_filter": 0, 62 | "label": "Capacity", 63 | "length": 0, 64 | "no_copy": 0, 65 | "permlevel": 0, 66 | "precision": "", 67 | "print_hide": 0, 68 | "print_hide_if_no_value": 0, 69 | "read_only": 0, 70 | "remember_last_selected_value": 0, 71 | "report_hide": 0, 72 | "reqd": 1, 73 | "search_index": 0, 74 | "set_only_once": 0, 75 | "unique": 0 76 | }, 77 | { 78 | "allow_bulk_edit": 0, 79 | "allow_on_submit": 0, 80 | "bold": 0, 81 | "collapsible": 0, 82 | "columns": 0, 83 | "fieldname": "extra_bed_capacity", 84 | "fieldtype": "Int", 85 | "hidden": 0, 86 | "ignore_user_permissions": 0, 87 | "ignore_xss_filter": 0, 88 | "in_filter": 0, 89 | "in_global_search": 0, 90 | "in_list_view": 0, 91 | "in_standard_filter": 0, 92 | "label": "Extra Bed Capacity", 93 | "length": 0, 94 | "no_copy": 0, 95 | "permlevel": 0, 96 | "precision": "", 97 | "print_hide": 0, 98 | "print_hide_if_no_value": 0, 99 | "read_only": 0, 100 | "remember_last_selected_value": 0, 101 | "report_hide": 0, 102 | "reqd": 0, 103 | "search_index": 0, 104 | "set_only_once": 0, 105 | "unique": 0 106 | } 107 | ], 108 | "has_web_view": 0, 109 | "hide_heading": 0, 110 | "hide_toolbar": 0, 111 | "idx": 0, 112 | "image_view": 0, 113 | "in_create": 0, 114 | "is_submittable": 0, 115 | "issingle": 0, 116 | "istable": 0, 117 | "max_attachments": 0, 118 | "modified": "2017-12-09 12:10:50.670113", 119 | "modified_by": "Administrator", 120 | "module": "Hotels", 121 | "name": "Hotel Room", 122 | "name_case": "", 123 | "owner": "Administrator", 124 | "permissions": [ 125 | { 126 | "amend": 0, 127 | "apply_user_permissions": 0, 128 | "cancel": 0, 129 | "create": 1, 130 | "delete": 1, 131 | "email": 1, 132 | "export": 1, 133 | "if_owner": 0, 134 | "import": 0, 135 | "permlevel": 0, 136 | "print": 1, 137 | "read": 1, 138 | "report": 1, 139 | "role": "System Manager", 140 | "set_user_permissions": 0, 141 | "share": 1, 142 | "submit": 0, 143 | "write": 1 144 | }, 145 | { 146 | "amend": 0, 147 | "apply_user_permissions": 0, 148 | "cancel": 0, 149 | "create": 1, 150 | "delete": 1, 151 | "email": 1, 152 | "export": 1, 153 | "if_owner": 0, 154 | "import": 0, 155 | "permlevel": 0, 156 | "print": 1, 157 | "read": 1, 158 | "report": 1, 159 | "role": "Hotel Manager", 160 | "set_user_permissions": 0, 161 | "share": 1, 162 | "submit": 0, 163 | "write": 1 164 | } 165 | ], 166 | "quick_entry": 1, 167 | "read_only": 0, 168 | "read_only_onload": 0, 169 | "restrict_to_domain": "Hospitality", 170 | "show_name_in_global_search": 0, 171 | "sort_field": "modified", 172 | "sort_order": "DESC", 173 | "track_changes": 1, 174 | "track_seen": 0 175 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room/hotel_room.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import frappe 6 | from frappe.model.document import Document 7 | 8 | 9 | class HotelRoom(Document): 10 | def validate(self): 11 | if not self.capacity: 12 | self.capacity, self.extra_bed_capacity = frappe.db.get_value('Hotel Room Type', 13 | self.hotel_room_type, ['capacity', 'extra_bed_capacity']) 14 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room/test_hotel_room.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | test_dependencies = ["Hotel Room Package"] 7 | test_records = [ 8 | dict(doctype="Hotel Room", name="1001", 9 | hotel_room_type="Basic Room"), 10 | dict(doctype="Hotel Room", name="1002", 11 | hotel_room_type="Basic Room"), 12 | dict(doctype="Hotel Room", name="1003", 13 | hotel_room_type="Basic Room"), 14 | dict(doctype="Hotel Room", name="1004", 15 | hotel_room_type="Basic Room"), 16 | dict(doctype="Hotel Room", name="1005", 17 | hotel_room_type="Basic Room"), 18 | dict(doctype="Hotel Room", name="1006", 19 | hotel_room_type="Basic Room") 20 | ] 21 | 22 | class TestHotelRoom(unittest.TestCase): 23 | pass 24 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_amenity/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room_amenity/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_amenity/hotel_room_amenity.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "beta": 0, 7 | "creation": "2017-12-08 12:35:36.572185", 8 | "custom": 0, 9 | "docstatus": 0, 10 | "doctype": "DocType", 11 | "document_type": "", 12 | "editable_grid": 1, 13 | "engine": "InnoDB", 14 | "fields": [ 15 | { 16 | "allow_bulk_edit": 0, 17 | "allow_on_submit": 0, 18 | "bold": 0, 19 | "collapsible": 0, 20 | "columns": 0, 21 | "fieldname": "item", 22 | "fieldtype": "Link", 23 | "hidden": 0, 24 | "ignore_user_permissions": 0, 25 | "ignore_xss_filter": 0, 26 | "in_filter": 0, 27 | "in_global_search": 0, 28 | "in_list_view": 1, 29 | "in_standard_filter": 0, 30 | "label": "Item", 31 | "length": 0, 32 | "no_copy": 0, 33 | "options": "Item", 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 1, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "billable", 53 | "fieldtype": "Check", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 1, 60 | "in_standard_filter": 0, 61 | "label": "Billable", 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 0, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | } 76 | ], 77 | "has_web_view": 0, 78 | "hide_heading": 0, 79 | "hide_toolbar": 0, 80 | "idx": 0, 81 | "image_view": 0, 82 | "in_create": 0, 83 | "is_submittable": 0, 84 | "issingle": 0, 85 | "istable": 1, 86 | "max_attachments": 0, 87 | "modified": "2017-12-09 12:05:07.125687", 88 | "modified_by": "Administrator", 89 | "module": "Hotels", 90 | "name": "Hotel Room Amenity", 91 | "name_case": "", 92 | "owner": "Administrator", 93 | "permissions": [], 94 | "quick_entry": 1, 95 | "read_only": 0, 96 | "read_only_onload": 0, 97 | "restrict_to_domain": "Hospitality", 98 | "show_name_in_global_search": 0, 99 | "sort_field": "modified", 100 | "sort_order": "DESC", 101 | "track_changes": 1, 102 | "track_seen": 0 103 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_amenity/hotel_room_amenity.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomAmenity(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_package/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room_package/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_package/hotel_room_package.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Package', { 5 | hotel_room_type: function(frm) { 6 | if (frm.doc.hotel_room_type) { 7 | frappe.model.with_doc('Hotel Room Type', frm.doc.hotel_room_type, () => { 8 | let hotel_room_type = frappe.get_doc('Hotel Room Type', frm.doc.hotel_room_type); 9 | 10 | // reset the amenities 11 | frm.doc.amenities = []; 12 | 13 | for (let amenity of hotel_room_type.amenities) { 14 | let d = frm.add_child('amenities'); 15 | d.item = amenity.item; 16 | d.billable = amenity.billable; 17 | } 18 | 19 | frm.refresh(); 20 | }); 21 | } 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_package/hotel_room_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-12-08 12:43:17.211064", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "hotel_room_type", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 1, 30 | "in_standard_filter": 0, 31 | "label": "Hotel Room Type", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Hotel Room Type", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "column_break_2", 54 | "fieldtype": "Column Break", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 0, 61 | "in_standard_filter": 0, 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 0, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | }, 76 | { 77 | "allow_bulk_edit": 0, 78 | "allow_on_submit": 0, 79 | "bold": 0, 80 | "collapsible": 0, 81 | "columns": 0, 82 | "fieldname": "item", 83 | "fieldtype": "Link", 84 | "hidden": 0, 85 | "ignore_user_permissions": 0, 86 | "ignore_xss_filter": 0, 87 | "in_filter": 0, 88 | "in_global_search": 0, 89 | "in_list_view": 0, 90 | "in_standard_filter": 0, 91 | "label": "Item", 92 | "length": 0, 93 | "no_copy": 0, 94 | "options": "Item", 95 | "permlevel": 0, 96 | "precision": "", 97 | "print_hide": 0, 98 | "print_hide_if_no_value": 0, 99 | "read_only": 0, 100 | "remember_last_selected_value": 0, 101 | "report_hide": 0, 102 | "reqd": 0, 103 | "search_index": 0, 104 | "set_only_once": 0, 105 | "unique": 0 106 | }, 107 | { 108 | "allow_bulk_edit": 0, 109 | "allow_on_submit": 0, 110 | "bold": 0, 111 | "collapsible": 0, 112 | "columns": 0, 113 | "fieldname": "section_break_4", 114 | "fieldtype": "Section Break", 115 | "hidden": 0, 116 | "ignore_user_permissions": 0, 117 | "ignore_xss_filter": 0, 118 | "in_filter": 0, 119 | "in_global_search": 0, 120 | "in_list_view": 0, 121 | "in_standard_filter": 0, 122 | "length": 0, 123 | "no_copy": 0, 124 | "permlevel": 0, 125 | "precision": "", 126 | "print_hide": 0, 127 | "print_hide_if_no_value": 0, 128 | "read_only": 0, 129 | "remember_last_selected_value": 0, 130 | "report_hide": 0, 131 | "reqd": 0, 132 | "search_index": 0, 133 | "set_only_once": 0, 134 | "unique": 0 135 | }, 136 | { 137 | "allow_bulk_edit": 0, 138 | "allow_on_submit": 0, 139 | "bold": 0, 140 | "collapsible": 0, 141 | "columns": 0, 142 | "fieldname": "amenities", 143 | "fieldtype": "Table", 144 | "hidden": 0, 145 | "ignore_user_permissions": 0, 146 | "ignore_xss_filter": 0, 147 | "in_filter": 0, 148 | "in_global_search": 0, 149 | "in_list_view": 0, 150 | "in_standard_filter": 0, 151 | "label": "Amenities", 152 | "length": 0, 153 | "no_copy": 0, 154 | "options": "Hotel Room Amenity", 155 | "permlevel": 0, 156 | "precision": "", 157 | "print_hide": 0, 158 | "print_hide_if_no_value": 0, 159 | "read_only": 0, 160 | "remember_last_selected_value": 0, 161 | "report_hide": 0, 162 | "reqd": 1, 163 | "search_index": 0, 164 | "set_only_once": 0, 165 | "unique": 0 166 | } 167 | ], 168 | "has_web_view": 0, 169 | "hide_heading": 0, 170 | "hide_toolbar": 0, 171 | "idx": 0, 172 | "image_view": 0, 173 | "in_create": 0, 174 | "is_submittable": 0, 175 | "issingle": 0, 176 | "istable": 0, 177 | "max_attachments": 0, 178 | "modified": "2017-12-09 12:10:31.111952", 179 | "modified_by": "Administrator", 180 | "module": "Hotels", 181 | "name": "Hotel Room Package", 182 | "name_case": "", 183 | "owner": "Administrator", 184 | "permissions": [ 185 | { 186 | "amend": 0, 187 | "apply_user_permissions": 0, 188 | "cancel": 0, 189 | "create": 1, 190 | "delete": 1, 191 | "email": 1, 192 | "export": 1, 193 | "if_owner": 0, 194 | "import": 0, 195 | "permlevel": 0, 196 | "print": 1, 197 | "read": 1, 198 | "report": 1, 199 | "role": "System Manager", 200 | "set_user_permissions": 0, 201 | "share": 1, 202 | "submit": 0, 203 | "write": 1 204 | } 205 | ], 206 | "quick_entry": 0, 207 | "read_only": 0, 208 | "read_only_onload": 0, 209 | "restrict_to_domain": "Hospitality", 210 | "show_name_in_global_search": 0, 211 | "sort_field": "modified", 212 | "sort_order": "DESC", 213 | "track_changes": 1, 214 | "track_seen": 0 215 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_package/hotel_room_package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import frappe 6 | from frappe.model.document import Document 7 | 8 | 9 | class HotelRoomPackage(Document): 10 | def validate(self): 11 | if not self.item: 12 | item = frappe.get_doc(dict( 13 | doctype = 'Item', 14 | item_code = self.name, 15 | item_group = 'Products', 16 | is_stock_item = 0, 17 | stock_uom = 'Unit' 18 | )) 19 | item.insert() 20 | self.item = item.name 21 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_package/test_hotel_room_package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | test_records = [ 7 | dict(doctype='Item', item_code='Breakfast', 8 | item_group='Products', is_stock_item=0), 9 | dict(doctype='Item', item_code='Lunch', 10 | item_group='Products', is_stock_item=0), 11 | dict(doctype='Item', item_code='Dinner', 12 | item_group='Products', is_stock_item=0), 13 | dict(doctype='Item', item_code='WiFi', 14 | item_group='Products', is_stock_item=0), 15 | dict(doctype='Hotel Room Type', name="Delux Room", 16 | capacity=4, 17 | extra_bed_capacity=2, 18 | amenities = [ 19 | dict(item='WiFi', billable=0) 20 | ]), 21 | dict(doctype='Hotel Room Type', name="Basic Room", 22 | capacity=4, 23 | extra_bed_capacity=2, 24 | amenities = [ 25 | dict(item='Breakfast', billable=0) 26 | ]), 27 | dict(doctype="Hotel Room Package", name="Basic Room with Breakfast", 28 | hotel_room_type="Basic Room", 29 | amenities = [ 30 | dict(item="Breakfast", billable=0) 31 | ]), 32 | dict(doctype="Hotel Room Package", name="Basic Room with Lunch", 33 | hotel_room_type="Basic Room", 34 | amenities = [ 35 | dict(item="Breakfast", billable=0), 36 | dict(item="Lunch", billable=0) 37 | ]), 38 | dict(doctype="Hotel Room Package", name="Basic Room with Dinner", 39 | hotel_room_type="Basic Room", 40 | amenities = [ 41 | dict(item="Breakfast", billable=0), 42 | dict(item="Dinner", billable=0) 43 | ]) 44 | ] 45 | 46 | class TestHotelRoomPackage(unittest.TestCase): 47 | pass 48 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room_pricing/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing/hotel_room_pricing.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Pricing', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing/hotel_room_pricing.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 1, 5 | "allow_rename": 0, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-12-08 12:51:47.088174", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "default": "1", 23 | "fieldname": "enabled", 24 | "fieldtype": "Check", 25 | "hidden": 0, 26 | "ignore_user_permissions": 0, 27 | "ignore_xss_filter": 0, 28 | "in_filter": 0, 29 | "in_global_search": 0, 30 | "in_list_view": 0, 31 | "in_standard_filter": 0, 32 | "label": "Enabled", 33 | "length": 0, 34 | "no_copy": 0, 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 0, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "currency", 54 | "fieldtype": "Link", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 1, 61 | "in_standard_filter": 0, 62 | "label": "Currency", 63 | "length": 0, 64 | "no_copy": 0, 65 | "options": "Currency", 66 | "permlevel": 0, 67 | "precision": "", 68 | "print_hide": 0, 69 | "print_hide_if_no_value": 0, 70 | "read_only": 0, 71 | "remember_last_selected_value": 0, 72 | "report_hide": 0, 73 | "reqd": 1, 74 | "search_index": 0, 75 | "set_only_once": 0, 76 | "unique": 0 77 | }, 78 | { 79 | "allow_bulk_edit": 0, 80 | "allow_on_submit": 0, 81 | "bold": 0, 82 | "collapsible": 0, 83 | "columns": 0, 84 | "fieldname": "from_date", 85 | "fieldtype": "Date", 86 | "hidden": 0, 87 | "ignore_user_permissions": 0, 88 | "ignore_xss_filter": 0, 89 | "in_filter": 0, 90 | "in_global_search": 0, 91 | "in_list_view": 0, 92 | "in_standard_filter": 0, 93 | "label": "From Date", 94 | "length": 0, 95 | "no_copy": 0, 96 | "permlevel": 0, 97 | "precision": "", 98 | "print_hide": 0, 99 | "print_hide_if_no_value": 0, 100 | "read_only": 0, 101 | "remember_last_selected_value": 0, 102 | "report_hide": 0, 103 | "reqd": 1, 104 | "search_index": 0, 105 | "set_only_once": 0, 106 | "unique": 0 107 | }, 108 | { 109 | "allow_bulk_edit": 0, 110 | "allow_on_submit": 0, 111 | "bold": 0, 112 | "collapsible": 0, 113 | "columns": 0, 114 | "fieldname": "to_date", 115 | "fieldtype": "Date", 116 | "hidden": 0, 117 | "ignore_user_permissions": 0, 118 | "ignore_xss_filter": 0, 119 | "in_filter": 0, 120 | "in_global_search": 0, 121 | "in_list_view": 0, 122 | "in_standard_filter": 0, 123 | "label": "To Date", 124 | "length": 0, 125 | "no_copy": 0, 126 | "permlevel": 0, 127 | "precision": "", 128 | "print_hide": 0, 129 | "print_hide_if_no_value": 0, 130 | "read_only": 0, 131 | "remember_last_selected_value": 0, 132 | "report_hide": 0, 133 | "reqd": 1, 134 | "search_index": 0, 135 | "set_only_once": 0, 136 | "unique": 0 137 | }, 138 | { 139 | "allow_bulk_edit": 0, 140 | "allow_on_submit": 0, 141 | "bold": 0, 142 | "collapsible": 0, 143 | "columns": 0, 144 | "fieldname": "section_break_5", 145 | "fieldtype": "Section Break", 146 | "hidden": 0, 147 | "ignore_user_permissions": 0, 148 | "ignore_xss_filter": 0, 149 | "in_filter": 0, 150 | "in_global_search": 0, 151 | "in_list_view": 0, 152 | "in_standard_filter": 0, 153 | "length": 0, 154 | "no_copy": 0, 155 | "permlevel": 0, 156 | "precision": "", 157 | "print_hide": 0, 158 | "print_hide_if_no_value": 0, 159 | "read_only": 0, 160 | "remember_last_selected_value": 0, 161 | "report_hide": 0, 162 | "reqd": 0, 163 | "search_index": 0, 164 | "set_only_once": 0, 165 | "unique": 0 166 | }, 167 | { 168 | "allow_bulk_edit": 0, 169 | "allow_on_submit": 0, 170 | "bold": 0, 171 | "collapsible": 0, 172 | "columns": 0, 173 | "fieldname": "items", 174 | "fieldtype": "Table", 175 | "hidden": 0, 176 | "ignore_user_permissions": 0, 177 | "ignore_xss_filter": 0, 178 | "in_filter": 0, 179 | "in_global_search": 0, 180 | "in_list_view": 0, 181 | "in_standard_filter": 0, 182 | "label": "Items", 183 | "length": 0, 184 | "no_copy": 0, 185 | "options": "Hotel Room Pricing Item", 186 | "permlevel": 0, 187 | "precision": "", 188 | "print_hide": 0, 189 | "print_hide_if_no_value": 0, 190 | "read_only": 0, 191 | "remember_last_selected_value": 0, 192 | "report_hide": 0, 193 | "reqd": 1, 194 | "search_index": 0, 195 | "set_only_once": 0, 196 | "unique": 0 197 | } 198 | ], 199 | "has_web_view": 0, 200 | "hide_heading": 0, 201 | "hide_toolbar": 0, 202 | "idx": 0, 203 | "image_view": 0, 204 | "in_create": 0, 205 | "is_submittable": 0, 206 | "issingle": 0, 207 | "istable": 0, 208 | "max_attachments": 0, 209 | "modified": "2017-12-09 12:10:41.559559", 210 | "modified_by": "Administrator", 211 | "module": "Hotels", 212 | "name": "Hotel Room Pricing", 213 | "name_case": "", 214 | "owner": "Administrator", 215 | "permissions": [ 216 | { 217 | "amend": 0, 218 | "apply_user_permissions": 0, 219 | "cancel": 0, 220 | "create": 1, 221 | "delete": 1, 222 | "email": 1, 223 | "export": 1, 224 | "if_owner": 0, 225 | "import": 0, 226 | "permlevel": 0, 227 | "print": 1, 228 | "read": 1, 229 | "report": 1, 230 | "role": "System Manager", 231 | "set_user_permissions": 0, 232 | "share": 1, 233 | "submit": 0, 234 | "write": 1 235 | }, 236 | { 237 | "amend": 0, 238 | "apply_user_permissions": 0, 239 | "cancel": 0, 240 | "create": 1, 241 | "delete": 1, 242 | "email": 1, 243 | "export": 1, 244 | "if_owner": 0, 245 | "import": 0, 246 | "permlevel": 0, 247 | "print": 1, 248 | "read": 1, 249 | "report": 1, 250 | "role": "Hotel Manager", 251 | "set_user_permissions": 0, 252 | "share": 1, 253 | "submit": 0, 254 | "write": 1 255 | } 256 | ], 257 | "quick_entry": 1, 258 | "read_only": 0, 259 | "read_only_onload": 0, 260 | "restrict_to_domain": "Hospitality", 261 | "show_name_in_global_search": 0, 262 | "sort_field": "modified", 263 | "sort_order": "DESC", 264 | "track_changes": 1, 265 | "track_seen": 0 266 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing/hotel_room_pricing.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomPricing(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing/test_hotel_room_pricing.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | test_dependencies = ["Hotel Room Package"] 7 | test_records = [ 8 | dict(doctype="Hotel Room Pricing", enabled=1, 9 | name="Winter 2017", 10 | from_date="2017-01-01", to_date="2017-01-10", 11 | items = [ 12 | dict(item="Basic Room with Breakfast", rate=10000), 13 | dict(item="Basic Room with Lunch", rate=11000), 14 | dict(item="Basic Room with Dinner", rate=12000) 15 | ]) 16 | ] 17 | 18 | class TestHotelRoomPricing(unittest.TestCase): 19 | pass 20 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing_item/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room_pricing_item/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing_item/hotel_room_pricing_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "beta": 0, 7 | "creation": "2017-12-08 12:50:13.486090", 8 | "custom": 0, 9 | "docstatus": 0, 10 | "doctype": "DocType", 11 | "document_type": "", 12 | "editable_grid": 1, 13 | "engine": "InnoDB", 14 | "fields": [ 15 | { 16 | "allow_bulk_edit": 0, 17 | "allow_on_submit": 0, 18 | "bold": 0, 19 | "collapsible": 0, 20 | "columns": 0, 21 | "fieldname": "item", 22 | "fieldtype": "Link", 23 | "hidden": 0, 24 | "ignore_user_permissions": 0, 25 | "ignore_xss_filter": 0, 26 | "in_filter": 0, 27 | "in_global_search": 0, 28 | "in_list_view": 1, 29 | "in_standard_filter": 0, 30 | "label": "Item", 31 | "length": 0, 32 | "no_copy": 0, 33 | "options": "Item", 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 1, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "rate", 53 | "fieldtype": "Currency", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 1, 60 | "in_standard_filter": 0, 61 | "label": "Rate", 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 1, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | } 76 | ], 77 | "has_web_view": 0, 78 | "hide_heading": 0, 79 | "hide_toolbar": 0, 80 | "idx": 0, 81 | "image_view": 0, 82 | "in_create": 0, 83 | "is_submittable": 0, 84 | "issingle": 0, 85 | "istable": 1, 86 | "max_attachments": 0, 87 | "modified": "2017-12-09 12:04:58.641703", 88 | "modified_by": "Administrator", 89 | "module": "Hotels", 90 | "name": "Hotel Room Pricing Item", 91 | "name_case": "", 92 | "owner": "Administrator", 93 | "permissions": [], 94 | "quick_entry": 1, 95 | "read_only": 0, 96 | "read_only_onload": 0, 97 | "restrict_to_domain": "Hospitality", 98 | "show_name_in_global_search": 0, 99 | "sort_field": "modified", 100 | "sort_order": "DESC", 101 | "track_changes": 1, 102 | "track_seen": 0 103 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing_item/hotel_room_pricing_item.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomPricingItem(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing_package/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room_pricing_package/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing_package/hotel_room_pricing_package.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Pricing Package', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing_package/hotel_room_pricing_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_events_in_timeline": 0, 4 | "allow_guest_to_view": 0, 5 | "allow_import": 0, 6 | "allow_rename": 0, 7 | "beta": 0, 8 | "creation": "2017-12-08 12:50:13.486090", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_in_quick_entry": 0, 19 | "allow_on_submit": 0, 20 | "bold": 0, 21 | "collapsible": 0, 22 | "columns": 0, 23 | "fieldname": "from_date", 24 | "fieldtype": "Date", 25 | "hidden": 0, 26 | "ignore_user_permissions": 0, 27 | "ignore_xss_filter": 0, 28 | "in_filter": 0, 29 | "in_global_search": 0, 30 | "in_list_view": 1, 31 | "in_standard_filter": 0, 32 | "label": "From Date", 33 | "length": 0, 34 | "no_copy": 0, 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "translatable": 0, 46 | "unique": 0 47 | }, 48 | { 49 | "allow_bulk_edit": 0, 50 | "allow_in_quick_entry": 0, 51 | "allow_on_submit": 0, 52 | "bold": 0, 53 | "collapsible": 0, 54 | "columns": 0, 55 | "fieldname": "to_date", 56 | "fieldtype": "Date", 57 | "hidden": 0, 58 | "ignore_user_permissions": 0, 59 | "ignore_xss_filter": 0, 60 | "in_filter": 0, 61 | "in_global_search": 0, 62 | "in_list_view": 1, 63 | "in_standard_filter": 0, 64 | "label": "To Date", 65 | "length": 0, 66 | "no_copy": 0, 67 | "permlevel": 0, 68 | "precision": "", 69 | "print_hide": 0, 70 | "print_hide_if_no_value": 0, 71 | "read_only": 0, 72 | "remember_last_selected_value": 0, 73 | "report_hide": 0, 74 | "reqd": 1, 75 | "search_index": 0, 76 | "set_only_once": 0, 77 | "translatable": 0, 78 | "unique": 0 79 | }, 80 | { 81 | "allow_bulk_edit": 0, 82 | "allow_in_quick_entry": 0, 83 | "allow_on_submit": 0, 84 | "bold": 0, 85 | "collapsible": 0, 86 | "columns": 0, 87 | "fieldname": "hotel_room_package", 88 | "fieldtype": "Link", 89 | "hidden": 0, 90 | "ignore_user_permissions": 0, 91 | "ignore_xss_filter": 0, 92 | "in_filter": 0, 93 | "in_global_search": 0, 94 | "in_list_view": 1, 95 | "in_standard_filter": 0, 96 | "label": "Hotel Room Package", 97 | "length": 0, 98 | "no_copy": 0, 99 | "options": "Hotel Room Package", 100 | "permlevel": 0, 101 | "precision": "", 102 | "print_hide": 0, 103 | "print_hide_if_no_value": 0, 104 | "read_only": 0, 105 | "remember_last_selected_value": 0, 106 | "report_hide": 0, 107 | "reqd": 1, 108 | "search_index": 0, 109 | "set_only_once": 0, 110 | "translatable": 0, 111 | "unique": 0 112 | }, 113 | { 114 | "allow_bulk_edit": 0, 115 | "allow_in_quick_entry": 0, 116 | "allow_on_submit": 0, 117 | "bold": 0, 118 | "collapsible": 0, 119 | "columns": 0, 120 | "fieldname": "rate", 121 | "fieldtype": "Currency", 122 | "hidden": 0, 123 | "ignore_user_permissions": 0, 124 | "ignore_xss_filter": 0, 125 | "in_filter": 0, 126 | "in_global_search": 0, 127 | "in_list_view": 1, 128 | "in_standard_filter": 0, 129 | "label": "Rate", 130 | "length": 0, 131 | "no_copy": 0, 132 | "permlevel": 0, 133 | "precision": "", 134 | "print_hide": 0, 135 | "print_hide_if_no_value": 0, 136 | "read_only": 0, 137 | "remember_last_selected_value": 0, 138 | "report_hide": 0, 139 | "reqd": 1, 140 | "search_index": 0, 141 | "set_only_once": 0, 142 | "translatable": 0, 143 | "unique": 0 144 | } 145 | ], 146 | "has_web_view": 0, 147 | "hide_heading": 0, 148 | "hide_toolbar": 0, 149 | "idx": 0, 150 | "image_view": 0, 151 | "in_create": 0, 152 | "is_submittable": 0, 153 | "issingle": 0, 154 | "istable": 1, 155 | "max_attachments": 0, 156 | "modified": "2018-11-04 03:34:02.551811", 157 | "modified_by": "Administrator", 158 | "module": "Hotels", 159 | "name": "Hotel Room Pricing Package", 160 | "name_case": "", 161 | "owner": "Administrator", 162 | "permissions": [], 163 | "quick_entry": 1, 164 | "read_only": 0, 165 | "read_only_onload": 0, 166 | "restrict_to_domain": "Hospitality", 167 | "show_name_in_global_search": 0, 168 | "sort_field": "modified", 169 | "sort_order": "DESC", 170 | "track_changes": 1, 171 | "track_seen": 0, 172 | "track_views": 0 173 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing_package/hotel_room_pricing_package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomPricingPackage(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_pricing_package/test_hotel_room_pricing_package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | 7 | class TestHotelRoomPricingPackage(unittest.TestCase): 8 | pass 9 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_reservation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room_reservation/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_reservation/hotel_room_reservation.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Reservation', { 5 | refresh: function(frm) { 6 | if(frm.doc.docstatus == 1){ 7 | frm.add_custom_button(__('Create Invoice'), ()=> { 8 | frm.trigger("make_invoice"); 9 | }); 10 | } 11 | }, 12 | from_date: function(frm) { 13 | frm.trigger("recalculate_rates"); 14 | }, 15 | to_date: function(frm) { 16 | frm.trigger("recalculate_rates"); 17 | }, 18 | recalculate_rates: function(frm) { 19 | if (!frm.doc.from_date || !frm.doc.to_date 20 | || !frm.doc.items.length){ 21 | return; 22 | } 23 | frappe.call({ 24 | "method": "hospitality.hotels.doctype.hotel_room_reservation.hotel_room_reservation.get_room_rate", 25 | "args": {"hotel_room_reservation": frm.doc} 26 | }).done((r)=> { 27 | for (var i = 0; i < r.message.items.length; i++) { 28 | frm.doc.items[i].rate = r.message.items[i].rate; 29 | frm.doc.items[i].amount = r.message.items[i].amount; 30 | } 31 | frappe.run_serially([ 32 | ()=> frm.set_value("net_total", r.message.net_total), 33 | ()=> frm.refresh_field("items") 34 | ]); 35 | }); 36 | }, 37 | make_invoice: function(frm) { 38 | frappe.model.with_doc("Hotel Settings", "Hotel Settings", ()=>{ 39 | frappe.model.with_doctype("Sales Invoice", ()=>{ 40 | let hotel_settings = frappe.get_doc("Hotel Settings", "Hotel Settings"); 41 | let invoice = frappe.model.get_new_doc("Sales Invoice"); 42 | invoice.customer = frm.doc.customer || hotel_settings.default_customer; 43 | if (hotel_settings.default_invoice_naming_series){ 44 | invoice.naming_series = hotel_settings.default_invoice_naming_series; 45 | } 46 | for (let d of frm.doc.items){ 47 | let invoice_item = frappe.model.add_child(invoice, "items") 48 | invoice_item.item_code = d.item; 49 | invoice_item.qty = d.qty; 50 | invoice_item.rate = d.rate; 51 | } 52 | if (hotel_settings.default_taxes_and_charges){ 53 | invoice.taxes_and_charges = hotel_settings.default_taxes_and_charges; 54 | } 55 | frappe.set_route("Form", invoice.doctype, invoice.name); 56 | }); 57 | }); 58 | } 59 | }); 60 | 61 | frappe.ui.form.on('Hotel Room Reservation Item', { 62 | item: function(frm, doctype, name) { 63 | frm.trigger("recalculate_rates"); 64 | }, 65 | qty: function(frm) { 66 | frm.trigger("recalculate_rates"); 67 | } 68 | }); 69 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_reservation/hotel_room_reservation.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import json 6 | 7 | import frappe 8 | from frappe import _ 9 | from frappe.model.document import Document 10 | from frappe.utils import add_days, date_diff, flt 11 | 12 | 13 | class HotelRoomUnavailableError(frappe.ValidationError): pass 14 | class HotelRoomPricingNotSetError(frappe.ValidationError): pass 15 | 16 | class HotelRoomReservation(Document): 17 | def validate(self): 18 | self.total_rooms = {} 19 | self.set_rates() 20 | self.validate_availability() 21 | 22 | def validate_availability(self): 23 | for i in range(date_diff(self.to_date, self.from_date)): 24 | day = add_days(self.from_date, i) 25 | self.rooms_booked = {} 26 | 27 | for d in self.items: 28 | if not d.item in self.rooms_booked: 29 | self.rooms_booked[d.item] = 0 30 | 31 | room_type = frappe.db.get_value("Hotel Room Package", 32 | d.item, 'hotel_room_type') 33 | rooms_booked = get_rooms_booked(room_type, day, exclude_reservation=self.name) \ 34 | + d.qty + self.rooms_booked.get(d.item) 35 | total_rooms = self.get_total_rooms(d.item) 36 | if total_rooms < rooms_booked: 37 | frappe.throw(_("Hotel Rooms of type {0} are unavailable on {1}").format(d.item, 38 | frappe.format(day, dict(fieldtype="Date"))), exc=HotelRoomUnavailableError) 39 | 40 | self.rooms_booked[d.item] += rooms_booked 41 | 42 | def get_total_rooms(self, item): 43 | if not item in self.total_rooms: 44 | self.total_rooms[item] = frappe.db.sql(""" 45 | select count(*) 46 | from 47 | `tabHotel Room Package` package 48 | inner join 49 | `tabHotel Room` room on package.hotel_room_type = room.hotel_room_type 50 | where 51 | package.item = %s""", item)[0][0] or 0 52 | 53 | return self.total_rooms[item] 54 | 55 | def set_rates(self): 56 | self.net_total = 0 57 | for d in self.items: 58 | net_rate = 0.0 59 | for i in range(date_diff(self.to_date, self.from_date)): 60 | day = add_days(self.from_date, i) 61 | if not d.item: 62 | continue 63 | day_rate = frappe.db.sql(""" 64 | select 65 | item.rate 66 | from 67 | `tabHotel Room Pricing Item` item, 68 | `tabHotel Room Pricing` pricing 69 | where 70 | item.parent = pricing.name 71 | and item.item = %s 72 | and %s between pricing.from_date 73 | and pricing.to_date""", (d.item, day)) 74 | 75 | if day_rate: 76 | net_rate += day_rate[0][0] 77 | else: 78 | frappe.throw( 79 | _("Please set Hotel Room Rate on {}").format( 80 | frappe.format(day, dict(fieldtype="Date"))), exc=HotelRoomPricingNotSetError) 81 | d.rate = net_rate 82 | d.amount = net_rate * flt(d.qty) 83 | self.net_total += d.amount 84 | 85 | @frappe.whitelist() 86 | def get_room_rate(hotel_room_reservation): 87 | """Calculate rate for each day as it may belong to different Hotel Room Pricing Item""" 88 | doc = frappe.get_doc(json.loads(hotel_room_reservation)) 89 | doc.set_rates() 90 | return doc.as_dict() 91 | 92 | def get_rooms_booked(room_type, day, exclude_reservation=None): 93 | exclude_condition = '' 94 | if exclude_reservation: 95 | exclude_condition = 'and reservation.name != {0}'.format(frappe.db.escape(exclude_reservation)) 96 | 97 | return frappe.db.sql(""" 98 | select sum(item.qty) 99 | from 100 | `tabHotel Room Package` room_package, 101 | `tabHotel Room Reservation Item` item, 102 | `tabHotel Room Reservation` reservation 103 | where 104 | item.parent = reservation.name 105 | and room_package.item = item.item 106 | and room_package.hotel_room_type = %s 107 | and reservation.docstatus = 1 108 | {exclude_condition} 109 | and %s between reservation.from_date 110 | and reservation.to_date""".format(exclude_condition=exclude_condition), 111 | (room_type, day))[0][0] or 0 112 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_reservation/hotel_room_reservation_calendar.js: -------------------------------------------------------------------------------- 1 | frappe.views.calendar["Hotel Room Reservation"] = { 2 | field_map: { 3 | "start": "from_date", 4 | "end": "to_date", 5 | "id": "name", 6 | "title": "guest_name", 7 | "status": "status" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_reservation/test_hotel_room_reservation.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | import frappe 7 | 8 | from hospitality.hospitality.doctype.hotel_room_reservation.hotel_room_reservation import ( 9 | HotelRoomPricingNotSetError, 10 | HotelRoomUnavailableError, 11 | ) 12 | 13 | test_dependencies = ["Hotel Room Package", "Hotel Room Pricing", "Hotel Room"] 14 | 15 | class TestHotelRoomReservation(unittest.TestCase): 16 | def setUp(self): 17 | frappe.db.sql("delete from `tabHotel Room Reservation`") 18 | frappe.db.sql("delete from `tabHotel Room Reservation Item`") 19 | 20 | def test_reservation(self): 21 | reservation = make_reservation( 22 | from_date="2017-01-01", 23 | to_date="2017-01-03", 24 | items=[ 25 | dict(item="Basic Room with Dinner", qty=2) 26 | ] 27 | ) 28 | reservation.insert() 29 | self.assertEqual(reservation.net_total, 48000) 30 | 31 | def test_price_not_set(self): 32 | reservation = make_reservation( 33 | from_date="2016-01-01", 34 | to_date="2016-01-03", 35 | items=[ 36 | dict(item="Basic Room with Dinner", qty=2) 37 | ] 38 | ) 39 | self.assertRaises(HotelRoomPricingNotSetError, reservation.insert) 40 | 41 | def test_room_unavailable(self): 42 | reservation = make_reservation( 43 | from_date="2017-01-01", 44 | to_date="2017-01-03", 45 | items=[ 46 | dict(item="Basic Room with Dinner", qty=2), 47 | ] 48 | ) 49 | reservation.insert() 50 | 51 | reservation = make_reservation( 52 | from_date="2017-01-01", 53 | to_date="2017-01-03", 54 | items=[ 55 | dict(item="Basic Room with Dinner", qty=20), 56 | ] 57 | ) 58 | self.assertRaises(HotelRoomUnavailableError, reservation.insert) 59 | 60 | def make_reservation(**kwargs): 61 | kwargs["doctype"] = "Hotel Room Reservation" 62 | if not "guest_name" in kwargs: 63 | kwargs["guest_name"] = "Test Guest" 64 | doc = frappe.get_doc(kwargs) 65 | return doc 66 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_reservation_item/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room_reservation_item/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_reservation_item/hotel_room_reservation_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "", 7 | "beta": 0, 8 | "creation": "2017-12-08 12:58:21.733330", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "item", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 1, 30 | "in_standard_filter": 0, 31 | "label": "Item", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Item", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "qty", 54 | "fieldtype": "Int", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 1, 61 | "in_standard_filter": 0, 62 | "label": "Qty", 63 | "length": 0, 64 | "no_copy": 0, 65 | "permlevel": 0, 66 | "precision": "", 67 | "print_hide": 0, 68 | "print_hide_if_no_value": 0, 69 | "read_only": 0, 70 | "remember_last_selected_value": 0, 71 | "report_hide": 0, 72 | "reqd": 0, 73 | "search_index": 0, 74 | "set_only_once": 0, 75 | "unique": 0 76 | }, 77 | { 78 | "allow_bulk_edit": 0, 79 | "allow_on_submit": 0, 80 | "bold": 0, 81 | "collapsible": 0, 82 | "columns": 0, 83 | "fieldname": "currency", 84 | "fieldtype": "Link", 85 | "hidden": 0, 86 | "ignore_user_permissions": 0, 87 | "ignore_xss_filter": 0, 88 | "in_filter": 0, 89 | "in_global_search": 0, 90 | "in_list_view": 0, 91 | "in_standard_filter": 0, 92 | "label": "Currency", 93 | "length": 0, 94 | "no_copy": 0, 95 | "options": "Currency", 96 | "permlevel": 0, 97 | "precision": "", 98 | "print_hide": 0, 99 | "print_hide_if_no_value": 0, 100 | "read_only": 0, 101 | "remember_last_selected_value": 0, 102 | "report_hide": 0, 103 | "reqd": 0, 104 | "search_index": 0, 105 | "set_only_once": 0, 106 | "unique": 0 107 | }, 108 | { 109 | "allow_bulk_edit": 0, 110 | "allow_on_submit": 0, 111 | "bold": 0, 112 | "collapsible": 0, 113 | "columns": 0, 114 | "fieldname": "rate", 115 | "fieldtype": "Currency", 116 | "hidden": 0, 117 | "ignore_user_permissions": 0, 118 | "ignore_xss_filter": 0, 119 | "in_filter": 0, 120 | "in_global_search": 0, 121 | "in_list_view": 1, 122 | "in_standard_filter": 0, 123 | "label": "Rate", 124 | "length": 0, 125 | "no_copy": 0, 126 | "permlevel": 0, 127 | "precision": "", 128 | "print_hide": 0, 129 | "print_hide_if_no_value": 0, 130 | "read_only": 0, 131 | "remember_last_selected_value": 0, 132 | "report_hide": 0, 133 | "reqd": 0, 134 | "search_index": 0, 135 | "set_only_once": 0, 136 | "unique": 0 137 | }, 138 | { 139 | "allow_bulk_edit": 0, 140 | "allow_on_submit": 0, 141 | "bold": 0, 142 | "collapsible": 0, 143 | "columns": 0, 144 | "fieldname": "amount", 145 | "fieldtype": "Currency", 146 | "hidden": 0, 147 | "ignore_user_permissions": 0, 148 | "ignore_xss_filter": 0, 149 | "in_filter": 0, 150 | "in_global_search": 0, 151 | "in_list_view": 1, 152 | "in_standard_filter": 0, 153 | "label": "Amount", 154 | "length": 0, 155 | "no_copy": 0, 156 | "permlevel": 0, 157 | "precision": "", 158 | "print_hide": 0, 159 | "print_hide_if_no_value": 0, 160 | "read_only": 0, 161 | "remember_last_selected_value": 0, 162 | "report_hide": 0, 163 | "reqd": 0, 164 | "search_index": 0, 165 | "set_only_once": 0, 166 | "unique": 0 167 | } 168 | ], 169 | "has_web_view": 0, 170 | "hide_heading": 0, 171 | "hide_toolbar": 0, 172 | "idx": 0, 173 | "image_view": 0, 174 | "in_create": 0, 175 | "is_submittable": 0, 176 | "issingle": 0, 177 | "istable": 1, 178 | "max_attachments": 0, 179 | "modified": "2017-12-09 12:04:34.562956", 180 | "modified_by": "Administrator", 181 | "module": "Hotels", 182 | "name": "Hotel Room Reservation Item", 183 | "name_case": "", 184 | "owner": "Administrator", 185 | "permissions": [], 186 | "quick_entry": 1, 187 | "read_only": 0, 188 | "read_only_onload": 0, 189 | "restrict_to_domain": "Hospitality", 190 | "show_name_in_global_search": 0, 191 | "sort_field": "modified", 192 | "sort_order": "DESC", 193 | "track_changes": 1, 194 | "track_seen": 0 195 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_reservation_item/hotel_room_reservation_item.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomReservationItem(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_type/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_room_type/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_type/hotel_room_type.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Type', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_type/hotel_room_type.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 1, 5 | "allow_rename": 1, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-12-08 12:38:29.485175", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "capacity", 23 | "fieldtype": "Int", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 0, 30 | "in_standard_filter": 0, 31 | "label": "Capacity", 32 | "length": 0, 33 | "no_copy": 0, 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 0, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "extra_bed_capacity", 53 | "fieldtype": "Int", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 0, 60 | "in_standard_filter": 0, 61 | "label": "Extra Bed Capacity", 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 0, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | }, 76 | { 77 | "allow_bulk_edit": 0, 78 | "allow_on_submit": 0, 79 | "bold": 0, 80 | "collapsible": 0, 81 | "columns": 0, 82 | "fieldname": "section_break_3", 83 | "fieldtype": "Section Break", 84 | "hidden": 0, 85 | "ignore_user_permissions": 0, 86 | "ignore_xss_filter": 0, 87 | "in_filter": 0, 88 | "in_global_search": 0, 89 | "in_list_view": 0, 90 | "in_standard_filter": 0, 91 | "length": 0, 92 | "no_copy": 0, 93 | "permlevel": 0, 94 | "precision": "", 95 | "print_hide": 0, 96 | "print_hide_if_no_value": 0, 97 | "read_only": 0, 98 | "remember_last_selected_value": 0, 99 | "report_hide": 0, 100 | "reqd": 0, 101 | "search_index": 0, 102 | "set_only_once": 0, 103 | "unique": 0 104 | }, 105 | { 106 | "allow_bulk_edit": 0, 107 | "allow_on_submit": 0, 108 | "bold": 0, 109 | "collapsible": 0, 110 | "columns": 0, 111 | "fieldname": "amenities", 112 | "fieldtype": "Table", 113 | "hidden": 0, 114 | "ignore_user_permissions": 0, 115 | "ignore_xss_filter": 0, 116 | "in_filter": 0, 117 | "in_global_search": 0, 118 | "in_list_view": 0, 119 | "in_standard_filter": 0, 120 | "label": "Amenities", 121 | "length": 0, 122 | "no_copy": 0, 123 | "options": "Hotel Room Amenity", 124 | "permlevel": 0, 125 | "precision": "", 126 | "print_hide": 0, 127 | "print_hide_if_no_value": 0, 128 | "read_only": 0, 129 | "remember_last_selected_value": 0, 130 | "report_hide": 0, 131 | "reqd": 1, 132 | "search_index": 0, 133 | "set_only_once": 0, 134 | "unique": 0 135 | } 136 | ], 137 | "has_web_view": 0, 138 | "hide_heading": 0, 139 | "hide_toolbar": 0, 140 | "idx": 0, 141 | "image_view": 0, 142 | "in_create": 0, 143 | "is_submittable": 0, 144 | "issingle": 0, 145 | "istable": 0, 146 | "max_attachments": 0, 147 | "modified": "2017-12-09 12:10:23.355486", 148 | "modified_by": "Administrator", 149 | "module": "Hotels", 150 | "name": "Hotel Room Type", 151 | "name_case": "", 152 | "owner": "Administrator", 153 | "permissions": [ 154 | { 155 | "amend": 0, 156 | "apply_user_permissions": 0, 157 | "cancel": 0, 158 | "create": 1, 159 | "delete": 1, 160 | "email": 1, 161 | "export": 1, 162 | "if_owner": 0, 163 | "import": 0, 164 | "permlevel": 0, 165 | "print": 1, 166 | "read": 1, 167 | "report": 1, 168 | "role": "System Manager", 169 | "set_user_permissions": 0, 170 | "share": 1, 171 | "submit": 0, 172 | "write": 1 173 | }, 174 | { 175 | "amend": 0, 176 | "apply_user_permissions": 0, 177 | "cancel": 0, 178 | "create": 1, 179 | "delete": 1, 180 | "email": 1, 181 | "export": 1, 182 | "if_owner": 0, 183 | "import": 0, 184 | "permlevel": 0, 185 | "print": 1, 186 | "read": 1, 187 | "report": 1, 188 | "role": "Hotel Manager", 189 | "set_user_permissions": 0, 190 | "share": 1, 191 | "submit": 0, 192 | "write": 1 193 | } 194 | ], 195 | "quick_entry": 1, 196 | "read_only": 0, 197 | "read_only_onload": 0, 198 | "restrict_to_domain": "Hospitality", 199 | "show_name_in_global_search": 0, 200 | "sort_field": "modified", 201 | "sort_order": "DESC", 202 | "track_changes": 1, 203 | "track_seen": 0 204 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_type/hotel_room_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomType(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_room_type/test_hotel_room_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | 7 | class TestHotelRoomType(unittest.TestCase): 8 | pass 9 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_settings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/doctype/hotel_settings/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_settings/hotel_settings.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Settings', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_settings/hotel_settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "beta": 1, 7 | "creation": "2017-12-08 17:50:24.523107", 8 | "custom": 0, 9 | "docstatus": 0, 10 | "doctype": "DocType", 11 | "document_type": "Setup", 12 | "editable_grid": 1, 13 | "engine": "InnoDB", 14 | "fields": [ 15 | { 16 | "allow_bulk_edit": 0, 17 | "allow_on_submit": 0, 18 | "bold": 0, 19 | "collapsible": 0, 20 | "columns": 0, 21 | "fieldname": "default_customer", 22 | "fieldtype": "Link", 23 | "hidden": 0, 24 | "ignore_user_permissions": 0, 25 | "ignore_xss_filter": 0, 26 | "in_filter": 0, 27 | "in_global_search": 0, 28 | "in_list_view": 1, 29 | "in_standard_filter": 0, 30 | "label": "Default Customer", 31 | "length": 0, 32 | "no_copy": 0, 33 | "options": "Customer", 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 1, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "default_taxes_and_charges", 53 | "fieldtype": "Link", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 0, 60 | "in_standard_filter": 0, 61 | "label": "Default Taxes and Charges", 62 | "length": 0, 63 | "no_copy": 0, 64 | "options": "Sales Taxes and Charges Template", 65 | "permlevel": 0, 66 | "precision": "", 67 | "print_hide": 0, 68 | "print_hide_if_no_value": 0, 69 | "read_only": 0, 70 | "remember_last_selected_value": 0, 71 | "report_hide": 0, 72 | "reqd": 0, 73 | "search_index": 0, 74 | "set_only_once": 0, 75 | "unique": 0 76 | }, 77 | { 78 | "allow_bulk_edit": 0, 79 | "allow_on_submit": 0, 80 | "bold": 0, 81 | "collapsible": 0, 82 | "columns": 0, 83 | "fieldname": "default_invoice_naming_series", 84 | "fieldtype": "Data", 85 | "hidden": 0, 86 | "ignore_user_permissions": 0, 87 | "ignore_xss_filter": 0, 88 | "in_filter": 0, 89 | "in_global_search": 0, 90 | "in_list_view": 0, 91 | "in_standard_filter": 0, 92 | "label": "Default Invoice Naming Series", 93 | "length": 0, 94 | "no_copy": 0, 95 | "permlevel": 0, 96 | "precision": "", 97 | "print_hide": 0, 98 | "print_hide_if_no_value": 0, 99 | "read_only": 0, 100 | "remember_last_selected_value": 0, 101 | "report_hide": 0, 102 | "reqd": 0, 103 | "search_index": 0, 104 | "set_only_once": 0, 105 | "unique": 0 106 | } 107 | ], 108 | "has_web_view": 0, 109 | "hide_heading": 0, 110 | "hide_toolbar": 0, 111 | "idx": 0, 112 | "image_view": 0, 113 | "in_create": 0, 114 | "is_submittable": 0, 115 | "issingle": 1, 116 | "istable": 0, 117 | "max_attachments": 0, 118 | "modified": "2017-12-09 12:11:12.857308", 119 | "modified_by": "Administrator", 120 | "module": "Hotels", 121 | "name": "Hotel Settings", 122 | "name_case": "", 123 | "owner": "Administrator", 124 | "permissions": [ 125 | { 126 | "amend": 0, 127 | "apply_user_permissions": 0, 128 | "cancel": 0, 129 | "create": 1, 130 | "delete": 1, 131 | "email": 1, 132 | "export": 0, 133 | "if_owner": 0, 134 | "import": 0, 135 | "permlevel": 0, 136 | "print": 1, 137 | "read": 1, 138 | "report": 0, 139 | "role": "System Manager", 140 | "set_user_permissions": 0, 141 | "share": 1, 142 | "submit": 0, 143 | "write": 1 144 | }, 145 | { 146 | "amend": 0, 147 | "apply_user_permissions": 0, 148 | "cancel": 0, 149 | "create": 1, 150 | "delete": 1, 151 | "email": 1, 152 | "export": 0, 153 | "if_owner": 0, 154 | "import": 0, 155 | "permlevel": 0, 156 | "print": 1, 157 | "read": 1, 158 | "report": 0, 159 | "role": "Hotel Manager", 160 | "set_user_permissions": 0, 161 | "share": 1, 162 | "submit": 0, 163 | "write": 1 164 | } 165 | ], 166 | "quick_entry": 0, 167 | "read_only": 0, 168 | "read_only_onload": 0, 169 | "restrict_to_domain": "Hospitality", 170 | "show_name_in_global_search": 0, 171 | "sort_field": "modified", 172 | "sort_order": "DESC", 173 | "track_changes": 1, 174 | "track_seen": 0 175 | } -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_settings/hotel_settings.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelSettings(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hospitality/doctype/hotel_settings/test_hotel_settings.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | 7 | class TestHotelSettings(unittest.TestCase): 8 | pass 9 | -------------------------------------------------------------------------------- /hospitality/hospitality/hospitality.py: -------------------------------------------------------------------------------- 1 | data = { 2 | "desktop_icons": ["Restaurant", "Hotels", "Accounts", "Buying", "Stock", "HR", "Project", "ToDo"], 3 | "restricted_roles": ["Restaurant Manager", "Hotel Manager", "Hotel Reservation User"], 4 | "custom_fields": { 5 | "Sales Invoice": [ 6 | { 7 | "fieldname": "restaurant", 8 | "fieldtype": "Link", 9 | "options": "Restaurant", 10 | "insert_after": "customer_name", 11 | "label": "Restaurant", 12 | }, 13 | { 14 | "fieldname": "restaurant_table", 15 | "fieldtype": "Link", 16 | "options": "Restaurant Table", 17 | "insert_after": "restaurant", 18 | "label": "Restaurant Table", 19 | }, 20 | ], 21 | "Price List": [ 22 | { 23 | "fieldname": "restaurant_menu", 24 | "fieldtype": "Link", 25 | "options": "Restaurant Menu", 26 | "label": "Restaurant Menu", 27 | "insert_after": "currency", 28 | } 29 | ], 30 | }, 31 | } -------------------------------------------------------------------------------- /hospitality/hospitality/report/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/report/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/report/hotel_room_occupancy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hospitality/report/hotel_room_occupancy/__init__.py -------------------------------------------------------------------------------- /hospitality/hospitality/report/hotel_room_occupancy/hotel_room_occupancy.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | /* eslint-disable */ 4 | 5 | frappe.query_reports["Hotel Room Occupancy"] = { 6 | "filters": [ 7 | { 8 | "fieldname":"from_date", 9 | "label": __("From Date"), 10 | "fieldtype": "Date", 11 | "default": frappe.datetime.now_date(), 12 | "reqd":1 13 | }, 14 | { 15 | "fieldname":"to_date", 16 | "label": __("To Date"), 17 | "fieldtype": "Date", 18 | "default": frappe.datetime.now_date(), 19 | "reqd":1 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /hospitality/hospitality/report/hotel_room_occupancy/hotel_room_occupancy.json: -------------------------------------------------------------------------------- 1 | { 2 | "add_total_row": 1, 3 | "apply_user_permissions": 1, 4 | "creation": "2017-12-09 14:31:26.306705", 5 | "disabled": 0, 6 | "docstatus": 0, 7 | "doctype": "Report", 8 | "idx": 0, 9 | "is_standard": "Yes", 10 | "modified": "2017-12-09 14:31:26.306705", 11 | "modified_by": "Administrator", 12 | "module": "Hotels", 13 | "name": "Hotel Room Occupancy", 14 | "owner": "Administrator", 15 | "ref_doctype": "Hotel Room Reservation", 16 | "report_name": "Hotel Room Occupancy", 17 | "report_type": "Script Report", 18 | "roles": [ 19 | { 20 | "role": "System Manager" 21 | }, 22 | { 23 | "role": "Hotel Reservation User" 24 | } 25 | ] 26 | } -------------------------------------------------------------------------------- /hospitality/hospitality/report/hotel_room_occupancy/hotel_room_occupancy.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import frappe 6 | from frappe import _ 7 | from frappe.utils import add_days, date_diff 8 | 9 | from hospitality.hospitality.doctype.hotel_room_reservation.hotel_room_reservation import get_rooms_booked 10 | 11 | 12 | def execute(filters=None): 13 | columns = get_columns(filters) 14 | data = get_data(filters) 15 | return columns, data 16 | 17 | def get_columns(filters): 18 | columns = [ 19 | dict(label=_("Room Type"), fieldname="room_type"), 20 | dict(label=_("Rooms Booked"), fieldtype="Int") 21 | ] 22 | return columns 23 | 24 | def get_data(filters): 25 | out = [] 26 | for room_type in frappe.get_all('Hotel Room Type'): 27 | total_booked = 0 28 | for i in range(date_diff(filters.to_date, filters.from_date)): 29 | day = add_days(filters.from_date, i) 30 | total_booked += get_rooms_booked(room_type.name, day) 31 | 32 | out.append([room_type.name, total_booked]) 33 | 34 | return out 35 | -------------------------------------------------------------------------------- /hospitality/hotels/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room/hotel_room.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room/hotel_room.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 1, 5 | "allow_rename": 1, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-12-08 12:33:56.320420", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "hotel_room_type", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 1, 30 | "in_standard_filter": 0, 31 | "label": "Hotel Room Type", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Hotel Room Type", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "capacity", 54 | "fieldtype": "Int", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 1, 61 | "in_standard_filter": 0, 62 | "label": "Capacity", 63 | "length": 0, 64 | "no_copy": 0, 65 | "permlevel": 0, 66 | "precision": "", 67 | "print_hide": 0, 68 | "print_hide_if_no_value": 0, 69 | "read_only": 0, 70 | "remember_last_selected_value": 0, 71 | "report_hide": 0, 72 | "reqd": 1, 73 | "search_index": 0, 74 | "set_only_once": 0, 75 | "unique": 0 76 | }, 77 | { 78 | "allow_bulk_edit": 0, 79 | "allow_on_submit": 0, 80 | "bold": 0, 81 | "collapsible": 0, 82 | "columns": 0, 83 | "fieldname": "extra_bed_capacity", 84 | "fieldtype": "Int", 85 | "hidden": 0, 86 | "ignore_user_permissions": 0, 87 | "ignore_xss_filter": 0, 88 | "in_filter": 0, 89 | "in_global_search": 0, 90 | "in_list_view": 0, 91 | "in_standard_filter": 0, 92 | "label": "Extra Bed Capacity", 93 | "length": 0, 94 | "no_copy": 0, 95 | "permlevel": 0, 96 | "precision": "", 97 | "print_hide": 0, 98 | "print_hide_if_no_value": 0, 99 | "read_only": 0, 100 | "remember_last_selected_value": 0, 101 | "report_hide": 0, 102 | "reqd": 0, 103 | "search_index": 0, 104 | "set_only_once": 0, 105 | "unique": 0 106 | } 107 | ], 108 | "has_web_view": 0, 109 | "hide_heading": 0, 110 | "hide_toolbar": 0, 111 | "idx": 0, 112 | "image_view": 0, 113 | "in_create": 0, 114 | "is_submittable": 0, 115 | "issingle": 0, 116 | "istable": 0, 117 | "max_attachments": 0, 118 | "modified": "2017-12-09 12:10:50.670113", 119 | "modified_by": "Administrator", 120 | "module": "Hotels", 121 | "name": "Hotel Room", 122 | "name_case": "", 123 | "owner": "Administrator", 124 | "permissions": [ 125 | { 126 | "amend": 0, 127 | "apply_user_permissions": 0, 128 | "cancel": 0, 129 | "create": 1, 130 | "delete": 1, 131 | "email": 1, 132 | "export": 1, 133 | "if_owner": 0, 134 | "import": 0, 135 | "permlevel": 0, 136 | "print": 1, 137 | "read": 1, 138 | "report": 1, 139 | "role": "System Manager", 140 | "set_user_permissions": 0, 141 | "share": 1, 142 | "submit": 0, 143 | "write": 1 144 | }, 145 | { 146 | "amend": 0, 147 | "apply_user_permissions": 0, 148 | "cancel": 0, 149 | "create": 1, 150 | "delete": 1, 151 | "email": 1, 152 | "export": 1, 153 | "if_owner": 0, 154 | "import": 0, 155 | "permlevel": 0, 156 | "print": 1, 157 | "read": 1, 158 | "report": 1, 159 | "role": "Hotel Manager", 160 | "set_user_permissions": 0, 161 | "share": 1, 162 | "submit": 0, 163 | "write": 1 164 | } 165 | ], 166 | "quick_entry": 1, 167 | "read_only": 0, 168 | "read_only_onload": 0, 169 | "restrict_to_domain": "Hospitality", 170 | "show_name_in_global_search": 0, 171 | "sort_field": "modified", 172 | "sort_order": "DESC", 173 | "track_changes": 1, 174 | "track_seen": 0 175 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room/hotel_room.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import frappe 6 | from frappe.model.document import Document 7 | 8 | 9 | class HotelRoom(Document): 10 | def validate(self): 11 | if not self.capacity: 12 | self.capacity, self.extra_bed_capacity = frappe.db.get_value('Hotel Room Type', 13 | self.hotel_room_type, ['capacity', 'extra_bed_capacity']) 14 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room/test_hotel_room.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | test_dependencies = ["Hotel Room Package"] 7 | test_records = [ 8 | dict(doctype="Hotel Room", name="1001", 9 | hotel_room_type="Basic Room"), 10 | dict(doctype="Hotel Room", name="1002", 11 | hotel_room_type="Basic Room"), 12 | dict(doctype="Hotel Room", name="1003", 13 | hotel_room_type="Basic Room"), 14 | dict(doctype="Hotel Room", name="1004", 15 | hotel_room_type="Basic Room"), 16 | dict(doctype="Hotel Room", name="1005", 17 | hotel_room_type="Basic Room"), 18 | dict(doctype="Hotel Room", name="1006", 19 | hotel_room_type="Basic Room") 20 | ] 21 | 22 | class TestHotelRoom(unittest.TestCase): 23 | pass 24 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_amenity/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room_amenity/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_amenity/hotel_room_amenity.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "beta": 0, 7 | "creation": "2017-12-08 12:35:36.572185", 8 | "custom": 0, 9 | "docstatus": 0, 10 | "doctype": "DocType", 11 | "document_type": "", 12 | "editable_grid": 1, 13 | "engine": "InnoDB", 14 | "fields": [ 15 | { 16 | "allow_bulk_edit": 0, 17 | "allow_on_submit": 0, 18 | "bold": 0, 19 | "collapsible": 0, 20 | "columns": 0, 21 | "fieldname": "item", 22 | "fieldtype": "Link", 23 | "hidden": 0, 24 | "ignore_user_permissions": 0, 25 | "ignore_xss_filter": 0, 26 | "in_filter": 0, 27 | "in_global_search": 0, 28 | "in_list_view": 1, 29 | "in_standard_filter": 0, 30 | "label": "Item", 31 | "length": 0, 32 | "no_copy": 0, 33 | "options": "Item", 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 1, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "billable", 53 | "fieldtype": "Check", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 1, 60 | "in_standard_filter": 0, 61 | "label": "Billable", 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 0, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | } 76 | ], 77 | "has_web_view": 0, 78 | "hide_heading": 0, 79 | "hide_toolbar": 0, 80 | "idx": 0, 81 | "image_view": 0, 82 | "in_create": 0, 83 | "is_submittable": 0, 84 | "issingle": 0, 85 | "istable": 1, 86 | "max_attachments": 0, 87 | "modified": "2017-12-09 12:05:07.125687", 88 | "modified_by": "Administrator", 89 | "module": "Hotels", 90 | "name": "Hotel Room Amenity", 91 | "name_case": "", 92 | "owner": "Administrator", 93 | "permissions": [], 94 | "quick_entry": 1, 95 | "read_only": 0, 96 | "read_only_onload": 0, 97 | "restrict_to_domain": "Hospitality", 98 | "show_name_in_global_search": 0, 99 | "sort_field": "modified", 100 | "sort_order": "DESC", 101 | "track_changes": 1, 102 | "track_seen": 0 103 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_amenity/hotel_room_amenity.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomAmenity(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_package/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room_package/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_package/hotel_room_package.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Package', { 5 | hotel_room_type: function(frm) { 6 | if (frm.doc.hotel_room_type) { 7 | frappe.model.with_doc('Hotel Room Type', frm.doc.hotel_room_type, () => { 8 | let hotel_room_type = frappe.get_doc('Hotel Room Type', frm.doc.hotel_room_type); 9 | 10 | // reset the amenities 11 | frm.doc.amenities = []; 12 | 13 | for (let amenity of hotel_room_type.amenities) { 14 | let d = frm.add_child('amenities'); 15 | d.item = amenity.item; 16 | d.billable = amenity.billable; 17 | } 18 | 19 | frm.refresh(); 20 | }); 21 | } 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_package/hotel_room_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-12-08 12:43:17.211064", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "hotel_room_type", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 1, 30 | "in_standard_filter": 0, 31 | "label": "Hotel Room Type", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Hotel Room Type", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "column_break_2", 54 | "fieldtype": "Column Break", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 0, 61 | "in_standard_filter": 0, 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 0, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | }, 76 | { 77 | "allow_bulk_edit": 0, 78 | "allow_on_submit": 0, 79 | "bold": 0, 80 | "collapsible": 0, 81 | "columns": 0, 82 | "fieldname": "item", 83 | "fieldtype": "Link", 84 | "hidden": 0, 85 | "ignore_user_permissions": 0, 86 | "ignore_xss_filter": 0, 87 | "in_filter": 0, 88 | "in_global_search": 0, 89 | "in_list_view": 0, 90 | "in_standard_filter": 0, 91 | "label": "Item", 92 | "length": 0, 93 | "no_copy": 0, 94 | "options": "Item", 95 | "permlevel": 0, 96 | "precision": "", 97 | "print_hide": 0, 98 | "print_hide_if_no_value": 0, 99 | "read_only": 0, 100 | "remember_last_selected_value": 0, 101 | "report_hide": 0, 102 | "reqd": 0, 103 | "search_index": 0, 104 | "set_only_once": 0, 105 | "unique": 0 106 | }, 107 | { 108 | "allow_bulk_edit": 0, 109 | "allow_on_submit": 0, 110 | "bold": 0, 111 | "collapsible": 0, 112 | "columns": 0, 113 | "fieldname": "section_break_4", 114 | "fieldtype": "Section Break", 115 | "hidden": 0, 116 | "ignore_user_permissions": 0, 117 | "ignore_xss_filter": 0, 118 | "in_filter": 0, 119 | "in_global_search": 0, 120 | "in_list_view": 0, 121 | "in_standard_filter": 0, 122 | "length": 0, 123 | "no_copy": 0, 124 | "permlevel": 0, 125 | "precision": "", 126 | "print_hide": 0, 127 | "print_hide_if_no_value": 0, 128 | "read_only": 0, 129 | "remember_last_selected_value": 0, 130 | "report_hide": 0, 131 | "reqd": 0, 132 | "search_index": 0, 133 | "set_only_once": 0, 134 | "unique": 0 135 | }, 136 | { 137 | "allow_bulk_edit": 0, 138 | "allow_on_submit": 0, 139 | "bold": 0, 140 | "collapsible": 0, 141 | "columns": 0, 142 | "fieldname": "amenities", 143 | "fieldtype": "Table", 144 | "hidden": 0, 145 | "ignore_user_permissions": 0, 146 | "ignore_xss_filter": 0, 147 | "in_filter": 0, 148 | "in_global_search": 0, 149 | "in_list_view": 0, 150 | "in_standard_filter": 0, 151 | "label": "Amenities", 152 | "length": 0, 153 | "no_copy": 0, 154 | "options": "Hotel Room Amenity", 155 | "permlevel": 0, 156 | "precision": "", 157 | "print_hide": 0, 158 | "print_hide_if_no_value": 0, 159 | "read_only": 0, 160 | "remember_last_selected_value": 0, 161 | "report_hide": 0, 162 | "reqd": 1, 163 | "search_index": 0, 164 | "set_only_once": 0, 165 | "unique": 0 166 | } 167 | ], 168 | "has_web_view": 0, 169 | "hide_heading": 0, 170 | "hide_toolbar": 0, 171 | "idx": 0, 172 | "image_view": 0, 173 | "in_create": 0, 174 | "is_submittable": 0, 175 | "issingle": 0, 176 | "istable": 0, 177 | "max_attachments": 0, 178 | "modified": "2017-12-09 12:10:31.111952", 179 | "modified_by": "Administrator", 180 | "module": "Hotels", 181 | "name": "Hotel Room Package", 182 | "name_case": "", 183 | "owner": "Administrator", 184 | "permissions": [ 185 | { 186 | "amend": 0, 187 | "apply_user_permissions": 0, 188 | "cancel": 0, 189 | "create": 1, 190 | "delete": 1, 191 | "email": 1, 192 | "export": 1, 193 | "if_owner": 0, 194 | "import": 0, 195 | "permlevel": 0, 196 | "print": 1, 197 | "read": 1, 198 | "report": 1, 199 | "role": "System Manager", 200 | "set_user_permissions": 0, 201 | "share": 1, 202 | "submit": 0, 203 | "write": 1 204 | } 205 | ], 206 | "quick_entry": 0, 207 | "read_only": 0, 208 | "read_only_onload": 0, 209 | "restrict_to_domain": "Hospitality", 210 | "show_name_in_global_search": 0, 211 | "sort_field": "modified", 212 | "sort_order": "DESC", 213 | "track_changes": 1, 214 | "track_seen": 0 215 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_package/hotel_room_package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import frappe 6 | from frappe.model.document import Document 7 | 8 | 9 | class HotelRoomPackage(Document): 10 | def validate(self): 11 | if not self.item: 12 | item = frappe.get_doc(dict( 13 | doctype = 'Item', 14 | item_code = self.name, 15 | item_group = 'Products', 16 | is_stock_item = 0, 17 | stock_uom = 'Unit' 18 | )) 19 | item.insert() 20 | self.item = item.name 21 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_package/test_hotel_room_package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | test_records = [ 7 | dict(doctype='Item', item_code='Breakfast', 8 | item_group='Products', is_stock_item=0), 9 | dict(doctype='Item', item_code='Lunch', 10 | item_group='Products', is_stock_item=0), 11 | dict(doctype='Item', item_code='Dinner', 12 | item_group='Products', is_stock_item=0), 13 | dict(doctype='Item', item_code='WiFi', 14 | item_group='Products', is_stock_item=0), 15 | dict(doctype='Hotel Room Type', name="Delux Room", 16 | capacity=4, 17 | extra_bed_capacity=2, 18 | amenities = [ 19 | dict(item='WiFi', billable=0) 20 | ]), 21 | dict(doctype='Hotel Room Type', name="Basic Room", 22 | capacity=4, 23 | extra_bed_capacity=2, 24 | amenities = [ 25 | dict(item='Breakfast', billable=0) 26 | ]), 27 | dict(doctype="Hotel Room Package", name="Basic Room with Breakfast", 28 | hotel_room_type="Basic Room", 29 | amenities = [ 30 | dict(item="Breakfast", billable=0) 31 | ]), 32 | dict(doctype="Hotel Room Package", name="Basic Room with Lunch", 33 | hotel_room_type="Basic Room", 34 | amenities = [ 35 | dict(item="Breakfast", billable=0), 36 | dict(item="Lunch", billable=0) 37 | ]), 38 | dict(doctype="Hotel Room Package", name="Basic Room with Dinner", 39 | hotel_room_type="Basic Room", 40 | amenities = [ 41 | dict(item="Breakfast", billable=0), 42 | dict(item="Dinner", billable=0) 43 | ]) 44 | ] 45 | 46 | class TestHotelRoomPackage(unittest.TestCase): 47 | pass 48 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room_pricing/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing/hotel_room_pricing.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Pricing', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing/hotel_room_pricing.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 1, 5 | "allow_rename": 0, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-12-08 12:51:47.088174", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "default": "1", 23 | "fieldname": "enabled", 24 | "fieldtype": "Check", 25 | "hidden": 0, 26 | "ignore_user_permissions": 0, 27 | "ignore_xss_filter": 0, 28 | "in_filter": 0, 29 | "in_global_search": 0, 30 | "in_list_view": 0, 31 | "in_standard_filter": 0, 32 | "label": "Enabled", 33 | "length": 0, 34 | "no_copy": 0, 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 0, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "currency", 54 | "fieldtype": "Link", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 1, 61 | "in_standard_filter": 0, 62 | "label": "Currency", 63 | "length": 0, 64 | "no_copy": 0, 65 | "options": "Currency", 66 | "permlevel": 0, 67 | "precision": "", 68 | "print_hide": 0, 69 | "print_hide_if_no_value": 0, 70 | "read_only": 0, 71 | "remember_last_selected_value": 0, 72 | "report_hide": 0, 73 | "reqd": 1, 74 | "search_index": 0, 75 | "set_only_once": 0, 76 | "unique": 0 77 | }, 78 | { 79 | "allow_bulk_edit": 0, 80 | "allow_on_submit": 0, 81 | "bold": 0, 82 | "collapsible": 0, 83 | "columns": 0, 84 | "fieldname": "from_date", 85 | "fieldtype": "Date", 86 | "hidden": 0, 87 | "ignore_user_permissions": 0, 88 | "ignore_xss_filter": 0, 89 | "in_filter": 0, 90 | "in_global_search": 0, 91 | "in_list_view": 0, 92 | "in_standard_filter": 0, 93 | "label": "From Date", 94 | "length": 0, 95 | "no_copy": 0, 96 | "permlevel": 0, 97 | "precision": "", 98 | "print_hide": 0, 99 | "print_hide_if_no_value": 0, 100 | "read_only": 0, 101 | "remember_last_selected_value": 0, 102 | "report_hide": 0, 103 | "reqd": 1, 104 | "search_index": 0, 105 | "set_only_once": 0, 106 | "unique": 0 107 | }, 108 | { 109 | "allow_bulk_edit": 0, 110 | "allow_on_submit": 0, 111 | "bold": 0, 112 | "collapsible": 0, 113 | "columns": 0, 114 | "fieldname": "to_date", 115 | "fieldtype": "Date", 116 | "hidden": 0, 117 | "ignore_user_permissions": 0, 118 | "ignore_xss_filter": 0, 119 | "in_filter": 0, 120 | "in_global_search": 0, 121 | "in_list_view": 0, 122 | "in_standard_filter": 0, 123 | "label": "To Date", 124 | "length": 0, 125 | "no_copy": 0, 126 | "permlevel": 0, 127 | "precision": "", 128 | "print_hide": 0, 129 | "print_hide_if_no_value": 0, 130 | "read_only": 0, 131 | "remember_last_selected_value": 0, 132 | "report_hide": 0, 133 | "reqd": 1, 134 | "search_index": 0, 135 | "set_only_once": 0, 136 | "unique": 0 137 | }, 138 | { 139 | "allow_bulk_edit": 0, 140 | "allow_on_submit": 0, 141 | "bold": 0, 142 | "collapsible": 0, 143 | "columns": 0, 144 | "fieldname": "section_break_5", 145 | "fieldtype": "Section Break", 146 | "hidden": 0, 147 | "ignore_user_permissions": 0, 148 | "ignore_xss_filter": 0, 149 | "in_filter": 0, 150 | "in_global_search": 0, 151 | "in_list_view": 0, 152 | "in_standard_filter": 0, 153 | "length": 0, 154 | "no_copy": 0, 155 | "permlevel": 0, 156 | "precision": "", 157 | "print_hide": 0, 158 | "print_hide_if_no_value": 0, 159 | "read_only": 0, 160 | "remember_last_selected_value": 0, 161 | "report_hide": 0, 162 | "reqd": 0, 163 | "search_index": 0, 164 | "set_only_once": 0, 165 | "unique": 0 166 | }, 167 | { 168 | "allow_bulk_edit": 0, 169 | "allow_on_submit": 0, 170 | "bold": 0, 171 | "collapsible": 0, 172 | "columns": 0, 173 | "fieldname": "items", 174 | "fieldtype": "Table", 175 | "hidden": 0, 176 | "ignore_user_permissions": 0, 177 | "ignore_xss_filter": 0, 178 | "in_filter": 0, 179 | "in_global_search": 0, 180 | "in_list_view": 0, 181 | "in_standard_filter": 0, 182 | "label": "Items", 183 | "length": 0, 184 | "no_copy": 0, 185 | "options": "Hotel Room Pricing Item", 186 | "permlevel": 0, 187 | "precision": "", 188 | "print_hide": 0, 189 | "print_hide_if_no_value": 0, 190 | "read_only": 0, 191 | "remember_last_selected_value": 0, 192 | "report_hide": 0, 193 | "reqd": 1, 194 | "search_index": 0, 195 | "set_only_once": 0, 196 | "unique": 0 197 | } 198 | ], 199 | "has_web_view": 0, 200 | "hide_heading": 0, 201 | "hide_toolbar": 0, 202 | "idx": 0, 203 | "image_view": 0, 204 | "in_create": 0, 205 | "is_submittable": 0, 206 | "issingle": 0, 207 | "istable": 0, 208 | "max_attachments": 0, 209 | "modified": "2017-12-09 12:10:41.559559", 210 | "modified_by": "Administrator", 211 | "module": "Hotels", 212 | "name": "Hotel Room Pricing", 213 | "name_case": "", 214 | "owner": "Administrator", 215 | "permissions": [ 216 | { 217 | "amend": 0, 218 | "apply_user_permissions": 0, 219 | "cancel": 0, 220 | "create": 1, 221 | "delete": 1, 222 | "email": 1, 223 | "export": 1, 224 | "if_owner": 0, 225 | "import": 0, 226 | "permlevel": 0, 227 | "print": 1, 228 | "read": 1, 229 | "report": 1, 230 | "role": "System Manager", 231 | "set_user_permissions": 0, 232 | "share": 1, 233 | "submit": 0, 234 | "write": 1 235 | }, 236 | { 237 | "amend": 0, 238 | "apply_user_permissions": 0, 239 | "cancel": 0, 240 | "create": 1, 241 | "delete": 1, 242 | "email": 1, 243 | "export": 1, 244 | "if_owner": 0, 245 | "import": 0, 246 | "permlevel": 0, 247 | "print": 1, 248 | "read": 1, 249 | "report": 1, 250 | "role": "Hotel Manager", 251 | "set_user_permissions": 0, 252 | "share": 1, 253 | "submit": 0, 254 | "write": 1 255 | } 256 | ], 257 | "quick_entry": 1, 258 | "read_only": 0, 259 | "read_only_onload": 0, 260 | "restrict_to_domain": "Hospitality", 261 | "show_name_in_global_search": 0, 262 | "sort_field": "modified", 263 | "sort_order": "DESC", 264 | "track_changes": 1, 265 | "track_seen": 0 266 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing/hotel_room_pricing.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomPricing(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing/test_hotel_room_pricing.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | test_dependencies = ["Hotel Room Package"] 7 | test_records = [ 8 | dict(doctype="Hotel Room Pricing", enabled=1, 9 | name="Winter 2017", 10 | from_date="2017-01-01", to_date="2017-01-10", 11 | items = [ 12 | dict(item="Basic Room with Breakfast", rate=10000), 13 | dict(item="Basic Room with Lunch", rate=11000), 14 | dict(item="Basic Room with Dinner", rate=12000) 15 | ]) 16 | ] 17 | 18 | class TestHotelRoomPricing(unittest.TestCase): 19 | pass 20 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing_item/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room_pricing_item/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing_item/hotel_room_pricing_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "beta": 0, 7 | "creation": "2017-12-08 12:50:13.486090", 8 | "custom": 0, 9 | "docstatus": 0, 10 | "doctype": "DocType", 11 | "document_type": "", 12 | "editable_grid": 1, 13 | "engine": "InnoDB", 14 | "fields": [ 15 | { 16 | "allow_bulk_edit": 0, 17 | "allow_on_submit": 0, 18 | "bold": 0, 19 | "collapsible": 0, 20 | "columns": 0, 21 | "fieldname": "item", 22 | "fieldtype": "Link", 23 | "hidden": 0, 24 | "ignore_user_permissions": 0, 25 | "ignore_xss_filter": 0, 26 | "in_filter": 0, 27 | "in_global_search": 0, 28 | "in_list_view": 1, 29 | "in_standard_filter": 0, 30 | "label": "Item", 31 | "length": 0, 32 | "no_copy": 0, 33 | "options": "Item", 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 1, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "rate", 53 | "fieldtype": "Currency", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 1, 60 | "in_standard_filter": 0, 61 | "label": "Rate", 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 1, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | } 76 | ], 77 | "has_web_view": 0, 78 | "hide_heading": 0, 79 | "hide_toolbar": 0, 80 | "idx": 0, 81 | "image_view": 0, 82 | "in_create": 0, 83 | "is_submittable": 0, 84 | "issingle": 0, 85 | "istable": 1, 86 | "max_attachments": 0, 87 | "modified": "2017-12-09 12:04:58.641703", 88 | "modified_by": "Administrator", 89 | "module": "Hotels", 90 | "name": "Hotel Room Pricing Item", 91 | "name_case": "", 92 | "owner": "Administrator", 93 | "permissions": [], 94 | "quick_entry": 1, 95 | "read_only": 0, 96 | "read_only_onload": 0, 97 | "restrict_to_domain": "Hospitality", 98 | "show_name_in_global_search": 0, 99 | "sort_field": "modified", 100 | "sort_order": "DESC", 101 | "track_changes": 1, 102 | "track_seen": 0 103 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing_item/hotel_room_pricing_item.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomPricingItem(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing_package/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room_pricing_package/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing_package/hotel_room_pricing_package.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Pricing Package', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing_package/hotel_room_pricing_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_events_in_timeline": 0, 4 | "allow_guest_to_view": 0, 5 | "allow_import": 0, 6 | "allow_rename": 0, 7 | "beta": 0, 8 | "creation": "2017-12-08 12:50:13.486090", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_in_quick_entry": 0, 19 | "allow_on_submit": 0, 20 | "bold": 0, 21 | "collapsible": 0, 22 | "columns": 0, 23 | "fieldname": "from_date", 24 | "fieldtype": "Date", 25 | "hidden": 0, 26 | "ignore_user_permissions": 0, 27 | "ignore_xss_filter": 0, 28 | "in_filter": 0, 29 | "in_global_search": 0, 30 | "in_list_view": 1, 31 | "in_standard_filter": 0, 32 | "label": "From Date", 33 | "length": 0, 34 | "no_copy": 0, 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "translatable": 0, 46 | "unique": 0 47 | }, 48 | { 49 | "allow_bulk_edit": 0, 50 | "allow_in_quick_entry": 0, 51 | "allow_on_submit": 0, 52 | "bold": 0, 53 | "collapsible": 0, 54 | "columns": 0, 55 | "fieldname": "to_date", 56 | "fieldtype": "Date", 57 | "hidden": 0, 58 | "ignore_user_permissions": 0, 59 | "ignore_xss_filter": 0, 60 | "in_filter": 0, 61 | "in_global_search": 0, 62 | "in_list_view": 1, 63 | "in_standard_filter": 0, 64 | "label": "To Date", 65 | "length": 0, 66 | "no_copy": 0, 67 | "permlevel": 0, 68 | "precision": "", 69 | "print_hide": 0, 70 | "print_hide_if_no_value": 0, 71 | "read_only": 0, 72 | "remember_last_selected_value": 0, 73 | "report_hide": 0, 74 | "reqd": 1, 75 | "search_index": 0, 76 | "set_only_once": 0, 77 | "translatable": 0, 78 | "unique": 0 79 | }, 80 | { 81 | "allow_bulk_edit": 0, 82 | "allow_in_quick_entry": 0, 83 | "allow_on_submit": 0, 84 | "bold": 0, 85 | "collapsible": 0, 86 | "columns": 0, 87 | "fieldname": "hotel_room_package", 88 | "fieldtype": "Link", 89 | "hidden": 0, 90 | "ignore_user_permissions": 0, 91 | "ignore_xss_filter": 0, 92 | "in_filter": 0, 93 | "in_global_search": 0, 94 | "in_list_view": 1, 95 | "in_standard_filter": 0, 96 | "label": "Hotel Room Package", 97 | "length": 0, 98 | "no_copy": 0, 99 | "options": "Hotel Room Package", 100 | "permlevel": 0, 101 | "precision": "", 102 | "print_hide": 0, 103 | "print_hide_if_no_value": 0, 104 | "read_only": 0, 105 | "remember_last_selected_value": 0, 106 | "report_hide": 0, 107 | "reqd": 1, 108 | "search_index": 0, 109 | "set_only_once": 0, 110 | "translatable": 0, 111 | "unique": 0 112 | }, 113 | { 114 | "allow_bulk_edit": 0, 115 | "allow_in_quick_entry": 0, 116 | "allow_on_submit": 0, 117 | "bold": 0, 118 | "collapsible": 0, 119 | "columns": 0, 120 | "fieldname": "rate", 121 | "fieldtype": "Currency", 122 | "hidden": 0, 123 | "ignore_user_permissions": 0, 124 | "ignore_xss_filter": 0, 125 | "in_filter": 0, 126 | "in_global_search": 0, 127 | "in_list_view": 1, 128 | "in_standard_filter": 0, 129 | "label": "Rate", 130 | "length": 0, 131 | "no_copy": 0, 132 | "permlevel": 0, 133 | "precision": "", 134 | "print_hide": 0, 135 | "print_hide_if_no_value": 0, 136 | "read_only": 0, 137 | "remember_last_selected_value": 0, 138 | "report_hide": 0, 139 | "reqd": 1, 140 | "search_index": 0, 141 | "set_only_once": 0, 142 | "translatable": 0, 143 | "unique": 0 144 | } 145 | ], 146 | "has_web_view": 0, 147 | "hide_heading": 0, 148 | "hide_toolbar": 0, 149 | "idx": 0, 150 | "image_view": 0, 151 | "in_create": 0, 152 | "is_submittable": 0, 153 | "issingle": 0, 154 | "istable": 1, 155 | "max_attachments": 0, 156 | "modified": "2018-11-04 03:34:02.551811", 157 | "modified_by": "Administrator", 158 | "module": "Hotels", 159 | "name": "Hotel Room Pricing Package", 160 | "name_case": "", 161 | "owner": "Administrator", 162 | "permissions": [], 163 | "quick_entry": 1, 164 | "read_only": 0, 165 | "read_only_onload": 0, 166 | "restrict_to_domain": "Hospitality", 167 | "show_name_in_global_search": 0, 168 | "sort_field": "modified", 169 | "sort_order": "DESC", 170 | "track_changes": 1, 171 | "track_seen": 0, 172 | "track_views": 0 173 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing_package/hotel_room_pricing_package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomPricingPackage(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_pricing_package/test_hotel_room_pricing_package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | 7 | class TestHotelRoomPricingPackage(unittest.TestCase): 8 | pass 9 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_reservation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room_reservation/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_reservation/hotel_room_reservation.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Reservation', { 5 | refresh: function(frm) { 6 | if(frm.doc.docstatus == 1){ 7 | frm.add_custom_button(__('Create Invoice'), ()=> { 8 | frm.trigger("make_invoice"); 9 | }); 10 | } 11 | }, 12 | from_date: function(frm) { 13 | frm.trigger("recalculate_rates"); 14 | }, 15 | to_date: function(frm) { 16 | frm.trigger("recalculate_rates"); 17 | }, 18 | recalculate_rates: function(frm) { 19 | if (!frm.doc.from_date || !frm.doc.to_date 20 | || !frm.doc.items.length){ 21 | return; 22 | } 23 | frappe.call({ 24 | "method": "hospitality.hotels.doctype.hotel_room_reservation.hotel_room_reservation.get_room_rate", 25 | "args": {"hotel_room_reservation": frm.doc} 26 | }).done((r)=> { 27 | for (var i = 0; i < r.message.items.length; i++) { 28 | frm.doc.items[i].rate = r.message.items[i].rate; 29 | frm.doc.items[i].amount = r.message.items[i].amount; 30 | } 31 | frappe.run_serially([ 32 | ()=> frm.set_value("net_total", r.message.net_total), 33 | ()=> frm.refresh_field("items") 34 | ]); 35 | }); 36 | }, 37 | make_invoice: function(frm) { 38 | frappe.model.with_doc("Hotel Settings", "Hotel Settings", ()=>{ 39 | frappe.model.with_doctype("Sales Invoice", ()=>{ 40 | let hotel_settings = frappe.get_doc("Hotel Settings", "Hotel Settings"); 41 | let invoice = frappe.model.get_new_doc("Sales Invoice"); 42 | invoice.customer = frm.doc.customer || hotel_settings.default_customer; 43 | if (hotel_settings.default_invoice_naming_series){ 44 | invoice.naming_series = hotel_settings.default_invoice_naming_series; 45 | } 46 | for (let d of frm.doc.items){ 47 | let invoice_item = frappe.model.add_child(invoice, "items") 48 | invoice_item.item_code = d.item; 49 | invoice_item.qty = d.qty; 50 | invoice_item.rate = d.rate; 51 | } 52 | if (hotel_settings.default_taxes_and_charges){ 53 | invoice.taxes_and_charges = hotel_settings.default_taxes_and_charges; 54 | } 55 | frappe.set_route("Form", invoice.doctype, invoice.name); 56 | }); 57 | }); 58 | } 59 | }); 60 | 61 | frappe.ui.form.on('Hotel Room Reservation Item', { 62 | item: function(frm, doctype, name) { 63 | frm.trigger("recalculate_rates"); 64 | }, 65 | qty: function(frm) { 66 | frm.trigger("recalculate_rates"); 67 | } 68 | }); 69 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_reservation/hotel_room_reservation.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import json 6 | 7 | import frappe 8 | from frappe import _ 9 | from frappe.model.document import Document 10 | from frappe.utils import add_days, date_diff, flt 11 | 12 | 13 | class HotelRoomUnavailableError(frappe.ValidationError): pass 14 | class HotelRoomPricingNotSetError(frappe.ValidationError): pass 15 | 16 | class HotelRoomReservation(Document): 17 | def validate(self): 18 | self.total_rooms = {} 19 | self.set_rates() 20 | self.validate_availability() 21 | 22 | def validate_availability(self): 23 | for i in range(date_diff(self.to_date, self.from_date)): 24 | day = add_days(self.from_date, i) 25 | self.rooms_booked = {} 26 | 27 | for d in self.items: 28 | if not d.item in self.rooms_booked: 29 | self.rooms_booked[d.item] = 0 30 | 31 | room_type = frappe.db.get_value("Hotel Room Package", 32 | d.item, 'hotel_room_type') 33 | rooms_booked = get_rooms_booked(room_type, day, exclude_reservation=self.name) \ 34 | + d.qty + self.rooms_booked.get(d.item) 35 | total_rooms = self.get_total_rooms(d.item) 36 | if total_rooms < rooms_booked: 37 | frappe.throw(_("Hotel Rooms of type {0} are unavailable on {1}").format(d.item, 38 | frappe.format(day, dict(fieldtype="Date"))), exc=HotelRoomUnavailableError) 39 | 40 | self.rooms_booked[d.item] += rooms_booked 41 | 42 | def get_total_rooms(self, item): 43 | if not item in self.total_rooms: 44 | self.total_rooms[item] = frappe.db.sql(""" 45 | select count(*) 46 | from 47 | `tabHotel Room Package` package 48 | inner join 49 | `tabHotel Room` room on package.hotel_room_type = room.hotel_room_type 50 | where 51 | package.item = %s""", item)[0][0] or 0 52 | 53 | return self.total_rooms[item] 54 | 55 | def set_rates(self): 56 | self.net_total = 0 57 | for d in self.items: 58 | net_rate = 0.0 59 | for i in range(date_diff(self.to_date, self.from_date)): 60 | day = add_days(self.from_date, i) 61 | if not d.item: 62 | continue 63 | day_rate = frappe.db.sql(""" 64 | select 65 | item.rate 66 | from 67 | `tabHotel Room Pricing Item` item, 68 | `tabHotel Room Pricing` pricing 69 | where 70 | item.parent = pricing.name 71 | and item.item = %s 72 | and %s between pricing.from_date 73 | and pricing.to_date""", (d.item, day)) 74 | 75 | if day_rate: 76 | net_rate += day_rate[0][0] 77 | else: 78 | frappe.throw( 79 | _("Please set Hotel Room Rate on {}").format( 80 | frappe.format(day, dict(fieldtype="Date"))), exc=HotelRoomPricingNotSetError) 81 | d.rate = net_rate 82 | d.amount = net_rate * flt(d.qty) 83 | self.net_total += d.amount 84 | 85 | @frappe.whitelist() 86 | def get_room_rate(hotel_room_reservation): 87 | """Calculate rate for each day as it may belong to different Hotel Room Pricing Item""" 88 | doc = frappe.get_doc(json.loads(hotel_room_reservation)) 89 | doc.set_rates() 90 | return doc.as_dict() 91 | 92 | def get_rooms_booked(room_type, day, exclude_reservation=None): 93 | exclude_condition = '' 94 | if exclude_reservation: 95 | exclude_condition = 'and reservation.name != {0}'.format(frappe.db.escape(exclude_reservation)) 96 | 97 | return frappe.db.sql(""" 98 | select sum(item.qty) 99 | from 100 | `tabHotel Room Package` room_package, 101 | `tabHotel Room Reservation Item` item, 102 | `tabHotel Room Reservation` reservation 103 | where 104 | item.parent = reservation.name 105 | and room_package.item = item.item 106 | and room_package.hotel_room_type = %s 107 | and reservation.docstatus = 1 108 | {exclude_condition} 109 | and %s between reservation.from_date 110 | and reservation.to_date""".format(exclude_condition=exclude_condition), 111 | (room_type, day))[0][0] or 0 112 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_reservation/hotel_room_reservation_calendar.js: -------------------------------------------------------------------------------- 1 | frappe.views.calendar["Hotel Room Reservation"] = { 2 | field_map: { 3 | "start": "from_date", 4 | "end": "to_date", 5 | "id": "name", 6 | "title": "guest_name", 7 | "status": "status" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_reservation/test_hotel_room_reservation.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | import frappe 7 | 8 | from hospitality.hotels.doctype.hotel_room_reservation.hotel_room_reservation import ( 9 | HotelRoomPricingNotSetError, 10 | HotelRoomUnavailableError, 11 | ) 12 | 13 | test_dependencies = ["Hotel Room Package", "Hotel Room Pricing", "Hotel Room"] 14 | 15 | class TestHotelRoomReservation(unittest.TestCase): 16 | def setUp(self): 17 | frappe.db.sql("delete from `tabHotel Room Reservation`") 18 | frappe.db.sql("delete from `tabHotel Room Reservation Item`") 19 | 20 | def test_reservation(self): 21 | reservation = make_reservation( 22 | from_date="2017-01-01", 23 | to_date="2017-01-03", 24 | items=[ 25 | dict(item="Basic Room with Dinner", qty=2) 26 | ] 27 | ) 28 | reservation.insert() 29 | self.assertEqual(reservation.net_total, 48000) 30 | 31 | def test_price_not_set(self): 32 | reservation = make_reservation( 33 | from_date="2016-01-01", 34 | to_date="2016-01-03", 35 | items=[ 36 | dict(item="Basic Room with Dinner", qty=2) 37 | ] 38 | ) 39 | self.assertRaises(HotelRoomPricingNotSetError, reservation.insert) 40 | 41 | def test_room_unavailable(self): 42 | reservation = make_reservation( 43 | from_date="2017-01-01", 44 | to_date="2017-01-03", 45 | items=[ 46 | dict(item="Basic Room with Dinner", qty=2), 47 | ] 48 | ) 49 | reservation.insert() 50 | 51 | reservation = make_reservation( 52 | from_date="2017-01-01", 53 | to_date="2017-01-03", 54 | items=[ 55 | dict(item="Basic Room with Dinner", qty=20), 56 | ] 57 | ) 58 | self.assertRaises(HotelRoomUnavailableError, reservation.insert) 59 | 60 | def make_reservation(**kwargs): 61 | kwargs["doctype"] = "Hotel Room Reservation" 62 | if not "guest_name" in kwargs: 63 | kwargs["guest_name"] = "Test Guest" 64 | doc = frappe.get_doc(kwargs) 65 | return doc 66 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_reservation_item/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room_reservation_item/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_reservation_item/hotel_room_reservation_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "", 7 | "beta": 0, 8 | "creation": "2017-12-08 12:58:21.733330", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "item", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 1, 30 | "in_standard_filter": 0, 31 | "label": "Item", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Item", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "qty", 54 | "fieldtype": "Int", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 1, 61 | "in_standard_filter": 0, 62 | "label": "Qty", 63 | "length": 0, 64 | "no_copy": 0, 65 | "permlevel": 0, 66 | "precision": "", 67 | "print_hide": 0, 68 | "print_hide_if_no_value": 0, 69 | "read_only": 0, 70 | "remember_last_selected_value": 0, 71 | "report_hide": 0, 72 | "reqd": 0, 73 | "search_index": 0, 74 | "set_only_once": 0, 75 | "unique": 0 76 | }, 77 | { 78 | "allow_bulk_edit": 0, 79 | "allow_on_submit": 0, 80 | "bold": 0, 81 | "collapsible": 0, 82 | "columns": 0, 83 | "fieldname": "currency", 84 | "fieldtype": "Link", 85 | "hidden": 0, 86 | "ignore_user_permissions": 0, 87 | "ignore_xss_filter": 0, 88 | "in_filter": 0, 89 | "in_global_search": 0, 90 | "in_list_view": 0, 91 | "in_standard_filter": 0, 92 | "label": "Currency", 93 | "length": 0, 94 | "no_copy": 0, 95 | "options": "Currency", 96 | "permlevel": 0, 97 | "precision": "", 98 | "print_hide": 0, 99 | "print_hide_if_no_value": 0, 100 | "read_only": 0, 101 | "remember_last_selected_value": 0, 102 | "report_hide": 0, 103 | "reqd": 0, 104 | "search_index": 0, 105 | "set_only_once": 0, 106 | "unique": 0 107 | }, 108 | { 109 | "allow_bulk_edit": 0, 110 | "allow_on_submit": 0, 111 | "bold": 0, 112 | "collapsible": 0, 113 | "columns": 0, 114 | "fieldname": "rate", 115 | "fieldtype": "Currency", 116 | "hidden": 0, 117 | "ignore_user_permissions": 0, 118 | "ignore_xss_filter": 0, 119 | "in_filter": 0, 120 | "in_global_search": 0, 121 | "in_list_view": 1, 122 | "in_standard_filter": 0, 123 | "label": "Rate", 124 | "length": 0, 125 | "no_copy": 0, 126 | "permlevel": 0, 127 | "precision": "", 128 | "print_hide": 0, 129 | "print_hide_if_no_value": 0, 130 | "read_only": 0, 131 | "remember_last_selected_value": 0, 132 | "report_hide": 0, 133 | "reqd": 0, 134 | "search_index": 0, 135 | "set_only_once": 0, 136 | "unique": 0 137 | }, 138 | { 139 | "allow_bulk_edit": 0, 140 | "allow_on_submit": 0, 141 | "bold": 0, 142 | "collapsible": 0, 143 | "columns": 0, 144 | "fieldname": "amount", 145 | "fieldtype": "Currency", 146 | "hidden": 0, 147 | "ignore_user_permissions": 0, 148 | "ignore_xss_filter": 0, 149 | "in_filter": 0, 150 | "in_global_search": 0, 151 | "in_list_view": 1, 152 | "in_standard_filter": 0, 153 | "label": "Amount", 154 | "length": 0, 155 | "no_copy": 0, 156 | "permlevel": 0, 157 | "precision": "", 158 | "print_hide": 0, 159 | "print_hide_if_no_value": 0, 160 | "read_only": 0, 161 | "remember_last_selected_value": 0, 162 | "report_hide": 0, 163 | "reqd": 0, 164 | "search_index": 0, 165 | "set_only_once": 0, 166 | "unique": 0 167 | } 168 | ], 169 | "has_web_view": 0, 170 | "hide_heading": 0, 171 | "hide_toolbar": 0, 172 | "idx": 0, 173 | "image_view": 0, 174 | "in_create": 0, 175 | "is_submittable": 0, 176 | "issingle": 0, 177 | "istable": 1, 178 | "max_attachments": 0, 179 | "modified": "2017-12-09 12:04:34.562956", 180 | "modified_by": "Administrator", 181 | "module": "Hotels", 182 | "name": "Hotel Room Reservation Item", 183 | "name_case": "", 184 | "owner": "Administrator", 185 | "permissions": [], 186 | "quick_entry": 1, 187 | "read_only": 0, 188 | "read_only_onload": 0, 189 | "restrict_to_domain": "Hospitality", 190 | "show_name_in_global_search": 0, 191 | "sort_field": "modified", 192 | "sort_order": "DESC", 193 | "track_changes": 1, 194 | "track_seen": 0 195 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_reservation_item/hotel_room_reservation_item.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomReservationItem(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_type/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_room_type/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_type/hotel_room_type.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Room Type', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_type/hotel_room_type.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 1, 5 | "allow_rename": 1, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-12-08 12:38:29.485175", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "capacity", 23 | "fieldtype": "Int", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 0, 30 | "in_standard_filter": 0, 31 | "label": "Capacity", 32 | "length": 0, 33 | "no_copy": 0, 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 0, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "extra_bed_capacity", 53 | "fieldtype": "Int", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 0, 60 | "in_standard_filter": 0, 61 | "label": "Extra Bed Capacity", 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 0, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | }, 76 | { 77 | "allow_bulk_edit": 0, 78 | "allow_on_submit": 0, 79 | "bold": 0, 80 | "collapsible": 0, 81 | "columns": 0, 82 | "fieldname": "section_break_3", 83 | "fieldtype": "Section Break", 84 | "hidden": 0, 85 | "ignore_user_permissions": 0, 86 | "ignore_xss_filter": 0, 87 | "in_filter": 0, 88 | "in_global_search": 0, 89 | "in_list_view": 0, 90 | "in_standard_filter": 0, 91 | "length": 0, 92 | "no_copy": 0, 93 | "permlevel": 0, 94 | "precision": "", 95 | "print_hide": 0, 96 | "print_hide_if_no_value": 0, 97 | "read_only": 0, 98 | "remember_last_selected_value": 0, 99 | "report_hide": 0, 100 | "reqd": 0, 101 | "search_index": 0, 102 | "set_only_once": 0, 103 | "unique": 0 104 | }, 105 | { 106 | "allow_bulk_edit": 0, 107 | "allow_on_submit": 0, 108 | "bold": 0, 109 | "collapsible": 0, 110 | "columns": 0, 111 | "fieldname": "amenities", 112 | "fieldtype": "Table", 113 | "hidden": 0, 114 | "ignore_user_permissions": 0, 115 | "ignore_xss_filter": 0, 116 | "in_filter": 0, 117 | "in_global_search": 0, 118 | "in_list_view": 0, 119 | "in_standard_filter": 0, 120 | "label": "Amenities", 121 | "length": 0, 122 | "no_copy": 0, 123 | "options": "Hotel Room Amenity", 124 | "permlevel": 0, 125 | "precision": "", 126 | "print_hide": 0, 127 | "print_hide_if_no_value": 0, 128 | "read_only": 0, 129 | "remember_last_selected_value": 0, 130 | "report_hide": 0, 131 | "reqd": 1, 132 | "search_index": 0, 133 | "set_only_once": 0, 134 | "unique": 0 135 | } 136 | ], 137 | "has_web_view": 0, 138 | "hide_heading": 0, 139 | "hide_toolbar": 0, 140 | "idx": 0, 141 | "image_view": 0, 142 | "in_create": 0, 143 | "is_submittable": 0, 144 | "issingle": 0, 145 | "istable": 0, 146 | "max_attachments": 0, 147 | "modified": "2017-12-09 12:10:23.355486", 148 | "modified_by": "Administrator", 149 | "module": "Hotels", 150 | "name": "Hotel Room Type", 151 | "name_case": "", 152 | "owner": "Administrator", 153 | "permissions": [ 154 | { 155 | "amend": 0, 156 | "apply_user_permissions": 0, 157 | "cancel": 0, 158 | "create": 1, 159 | "delete": 1, 160 | "email": 1, 161 | "export": 1, 162 | "if_owner": 0, 163 | "import": 0, 164 | "permlevel": 0, 165 | "print": 1, 166 | "read": 1, 167 | "report": 1, 168 | "role": "System Manager", 169 | "set_user_permissions": 0, 170 | "share": 1, 171 | "submit": 0, 172 | "write": 1 173 | }, 174 | { 175 | "amend": 0, 176 | "apply_user_permissions": 0, 177 | "cancel": 0, 178 | "create": 1, 179 | "delete": 1, 180 | "email": 1, 181 | "export": 1, 182 | "if_owner": 0, 183 | "import": 0, 184 | "permlevel": 0, 185 | "print": 1, 186 | "read": 1, 187 | "report": 1, 188 | "role": "Hotel Manager", 189 | "set_user_permissions": 0, 190 | "share": 1, 191 | "submit": 0, 192 | "write": 1 193 | } 194 | ], 195 | "quick_entry": 1, 196 | "read_only": 0, 197 | "read_only_onload": 0, 198 | "restrict_to_domain": "Hospitality", 199 | "show_name_in_global_search": 0, 200 | "sort_field": "modified", 201 | "sort_order": "DESC", 202 | "track_changes": 1, 203 | "track_seen": 0 204 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_type/hotel_room_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelRoomType(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_room_type/test_hotel_room_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | 7 | class TestHotelRoomType(unittest.TestCase): 8 | pass 9 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_settings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/doctype/hotel_settings/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_settings/hotel_settings.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Hotel Settings', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_settings/hotel_settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "beta": 1, 7 | "creation": "2017-12-08 17:50:24.523107", 8 | "custom": 0, 9 | "docstatus": 0, 10 | "doctype": "DocType", 11 | "document_type": "Setup", 12 | "editable_grid": 1, 13 | "engine": "InnoDB", 14 | "fields": [ 15 | { 16 | "allow_bulk_edit": 0, 17 | "allow_on_submit": 0, 18 | "bold": 0, 19 | "collapsible": 0, 20 | "columns": 0, 21 | "fieldname": "default_customer", 22 | "fieldtype": "Link", 23 | "hidden": 0, 24 | "ignore_user_permissions": 0, 25 | "ignore_xss_filter": 0, 26 | "in_filter": 0, 27 | "in_global_search": 0, 28 | "in_list_view": 1, 29 | "in_standard_filter": 0, 30 | "label": "Default Customer", 31 | "length": 0, 32 | "no_copy": 0, 33 | "options": "Customer", 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 1, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "default_taxes_and_charges", 53 | "fieldtype": "Link", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 0, 60 | "in_standard_filter": 0, 61 | "label": "Default Taxes and Charges", 62 | "length": 0, 63 | "no_copy": 0, 64 | "options": "Sales Taxes and Charges Template", 65 | "permlevel": 0, 66 | "precision": "", 67 | "print_hide": 0, 68 | "print_hide_if_no_value": 0, 69 | "read_only": 0, 70 | "remember_last_selected_value": 0, 71 | "report_hide": 0, 72 | "reqd": 0, 73 | "search_index": 0, 74 | "set_only_once": 0, 75 | "unique": 0 76 | }, 77 | { 78 | "allow_bulk_edit": 0, 79 | "allow_on_submit": 0, 80 | "bold": 0, 81 | "collapsible": 0, 82 | "columns": 0, 83 | "fieldname": "default_invoice_naming_series", 84 | "fieldtype": "Data", 85 | "hidden": 0, 86 | "ignore_user_permissions": 0, 87 | "ignore_xss_filter": 0, 88 | "in_filter": 0, 89 | "in_global_search": 0, 90 | "in_list_view": 0, 91 | "in_standard_filter": 0, 92 | "label": "Default Invoice Naming Series", 93 | "length": 0, 94 | "no_copy": 0, 95 | "permlevel": 0, 96 | "precision": "", 97 | "print_hide": 0, 98 | "print_hide_if_no_value": 0, 99 | "read_only": 0, 100 | "remember_last_selected_value": 0, 101 | "report_hide": 0, 102 | "reqd": 0, 103 | "search_index": 0, 104 | "set_only_once": 0, 105 | "unique": 0 106 | } 107 | ], 108 | "has_web_view": 0, 109 | "hide_heading": 0, 110 | "hide_toolbar": 0, 111 | "idx": 0, 112 | "image_view": 0, 113 | "in_create": 0, 114 | "is_submittable": 0, 115 | "issingle": 1, 116 | "istable": 0, 117 | "max_attachments": 0, 118 | "modified": "2017-12-09 12:11:12.857308", 119 | "modified_by": "Administrator", 120 | "module": "Hotels", 121 | "name": "Hotel Settings", 122 | "name_case": "", 123 | "owner": "Administrator", 124 | "permissions": [ 125 | { 126 | "amend": 0, 127 | "apply_user_permissions": 0, 128 | "cancel": 0, 129 | "create": 1, 130 | "delete": 1, 131 | "email": 1, 132 | "export": 0, 133 | "if_owner": 0, 134 | "import": 0, 135 | "permlevel": 0, 136 | "print": 1, 137 | "read": 1, 138 | "report": 0, 139 | "role": "System Manager", 140 | "set_user_permissions": 0, 141 | "share": 1, 142 | "submit": 0, 143 | "write": 1 144 | }, 145 | { 146 | "amend": 0, 147 | "apply_user_permissions": 0, 148 | "cancel": 0, 149 | "create": 1, 150 | "delete": 1, 151 | "email": 1, 152 | "export": 0, 153 | "if_owner": 0, 154 | "import": 0, 155 | "permlevel": 0, 156 | "print": 1, 157 | "read": 1, 158 | "report": 0, 159 | "role": "Hotel Manager", 160 | "set_user_permissions": 0, 161 | "share": 1, 162 | "submit": 0, 163 | "write": 1 164 | } 165 | ], 166 | "quick_entry": 0, 167 | "read_only": 0, 168 | "read_only_onload": 0, 169 | "restrict_to_domain": "Hospitality", 170 | "show_name_in_global_search": 0, 171 | "sort_field": "modified", 172 | "sort_order": "DESC", 173 | "track_changes": 1, 174 | "track_seen": 0 175 | } -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_settings/hotel_settings.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class HotelSettings(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/hotels/doctype/hotel_settings/test_hotel_settings.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | 7 | class TestHotelSettings(unittest.TestCase): 8 | pass 9 | -------------------------------------------------------------------------------- /hospitality/hotels/report/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/report/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/report/hotel_room_occupancy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/hotels/report/hotel_room_occupancy/__init__.py -------------------------------------------------------------------------------- /hospitality/hotels/report/hotel_room_occupancy/hotel_room_occupancy.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | /* eslint-disable */ 4 | 5 | frappe.query_reports["Hotel Room Occupancy"] = { 6 | "filters": [ 7 | { 8 | "fieldname":"from_date", 9 | "label": __("From Date"), 10 | "fieldtype": "Date", 11 | "default": frappe.datetime.now_date(), 12 | "reqd":1 13 | }, 14 | { 15 | "fieldname":"to_date", 16 | "label": __("To Date"), 17 | "fieldtype": "Date", 18 | "default": frappe.datetime.now_date(), 19 | "reqd":1 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /hospitality/hotels/report/hotel_room_occupancy/hotel_room_occupancy.json: -------------------------------------------------------------------------------- 1 | { 2 | "add_total_row": 1, 3 | "apply_user_permissions": 1, 4 | "creation": "2017-12-09 14:31:26.306705", 5 | "disabled": 0, 6 | "docstatus": 0, 7 | "doctype": "Report", 8 | "idx": 0, 9 | "is_standard": "Yes", 10 | "modified": "2017-12-09 14:31:26.306705", 11 | "modified_by": "Administrator", 12 | "module": "Hotels", 13 | "name": "Hotel Room Occupancy", 14 | "owner": "Administrator", 15 | "ref_doctype": "Hotel Room Reservation", 16 | "report_name": "Hotel Room Occupancy", 17 | "report_type": "Script Report", 18 | "roles": [ 19 | { 20 | "role": "System Manager" 21 | }, 22 | { 23 | "role": "Hotel Reservation User" 24 | } 25 | ] 26 | } -------------------------------------------------------------------------------- /hospitality/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import frappe 6 | from frappe import _ 7 | from frappe.utils import add_days, date_diff 8 | 9 | from hospitality.hotels.doctype.hotel_room_reservation.hotel_room_reservation import get_rooms_booked 10 | 11 | 12 | def execute(filters=None): 13 | columns = get_columns(filters) 14 | data = get_data(filters) 15 | return columns, data 16 | 17 | def get_columns(filters): 18 | columns = [ 19 | dict(label=_("Room Type"), fieldname="room_type"), 20 | dict(label=_("Rooms Booked"), fieldtype="Int") 21 | ] 22 | return columns 23 | 24 | def get_data(filters): 25 | out = [] 26 | for room_type in frappe.get_all('Hotel Room Type'): 27 | total_booked = 0 28 | for i in range(date_diff(filters.to_date, filters.from_date)): 29 | day = add_days(filters.from_date, i) 30 | total_booked += get_rooms_booked(room_type.name, day) 31 | 32 | out.append([room_type.name, total_booked]) 33 | 34 | return out 35 | -------------------------------------------------------------------------------- /hospitality/modules.txt: -------------------------------------------------------------------------------- 1 | Hospitality 2 | Hotels 3 | Restaurant -------------------------------------------------------------------------------- /hospitality/patches.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/patches.txt -------------------------------------------------------------------------------- /hospitality/restaurant/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/doctype/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/doctype/restaurant/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant/restaurant.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Restaurant', { 5 | refresh: function(frm) { 6 | frm.add_custom_button(__('Order Entry'), () => { 7 | frappe.set_route('Form', 'Restaurant Order Entry'); 8 | }); 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant/restaurant.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-09-15 12:40:41.546933", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "image", 23 | "fieldtype": "Attach Image", 24 | "hidden": 1, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 0, 30 | "in_standard_filter": 0, 31 | "label": "Image", 32 | "length": 0, 33 | "no_copy": 0, 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 1, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 0, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "company", 53 | "fieldtype": "Link", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 0, 60 | "in_standard_filter": 0, 61 | "label": "Company", 62 | "length": 0, 63 | "no_copy": 0, 64 | "options": "Company", 65 | "permlevel": 0, 66 | "precision": "", 67 | "print_hide": 0, 68 | "print_hide_if_no_value": 0, 69 | "read_only": 0, 70 | "remember_last_selected_value": 0, 71 | "report_hide": 0, 72 | "reqd": 1, 73 | "search_index": 0, 74 | "set_only_once": 0, 75 | "unique": 0 76 | }, 77 | { 78 | "allow_bulk_edit": 0, 79 | "allow_on_submit": 0, 80 | "bold": 0, 81 | "collapsible": 0, 82 | "columns": 0, 83 | "fieldname": "default_customer", 84 | "fieldtype": "Link", 85 | "hidden": 0, 86 | "ignore_user_permissions": 0, 87 | "ignore_xss_filter": 0, 88 | "in_filter": 0, 89 | "in_global_search": 0, 90 | "in_list_view": 0, 91 | "in_standard_filter": 0, 92 | "label": "Default Customer", 93 | "length": 0, 94 | "no_copy": 0, 95 | "options": "Customer", 96 | "permlevel": 0, 97 | "precision": "", 98 | "print_hide": 0, 99 | "print_hide_if_no_value": 0, 100 | "read_only": 0, 101 | "remember_last_selected_value": 0, 102 | "report_hide": 0, 103 | "reqd": 1, 104 | "search_index": 0, 105 | "set_only_once": 0, 106 | "unique": 0 107 | }, 108 | { 109 | "allow_bulk_edit": 0, 110 | "allow_on_submit": 0, 111 | "bold": 0, 112 | "collapsible": 0, 113 | "columns": 0, 114 | "fieldname": "invoice_series_prefix", 115 | "fieldtype": "Data", 116 | "hidden": 0, 117 | "ignore_user_permissions": 0, 118 | "ignore_xss_filter": 0, 119 | "in_filter": 0, 120 | "in_global_search": 0, 121 | "in_list_view": 1, 122 | "in_standard_filter": 0, 123 | "label": "Invoice Series Prefix", 124 | "length": 0, 125 | "no_copy": 0, 126 | "permlevel": 0, 127 | "precision": "", 128 | "print_hide": 0, 129 | "print_hide_if_no_value": 0, 130 | "read_only": 0, 131 | "remember_last_selected_value": 0, 132 | "report_hide": 0, 133 | "reqd": 1, 134 | "search_index": 0, 135 | "set_only_once": 0, 136 | "unique": 0 137 | }, 138 | { 139 | "allow_bulk_edit": 0, 140 | "allow_on_submit": 0, 141 | "bold": 0, 142 | "collapsible": 0, 143 | "columns": 0, 144 | "fieldname": "column_break_4", 145 | "fieldtype": "Column Break", 146 | "hidden": 0, 147 | "ignore_user_permissions": 0, 148 | "ignore_xss_filter": 0, 149 | "in_filter": 0, 150 | "in_global_search": 0, 151 | "in_list_view": 0, 152 | "in_standard_filter": 0, 153 | "length": 0, 154 | "no_copy": 0, 155 | "permlevel": 0, 156 | "precision": "", 157 | "print_hide": 0, 158 | "print_hide_if_no_value": 0, 159 | "read_only": 0, 160 | "remember_last_selected_value": 0, 161 | "report_hide": 0, 162 | "reqd": 0, 163 | "search_index": 0, 164 | "set_only_once": 0, 165 | "unique": 0 166 | }, 167 | { 168 | "allow_bulk_edit": 0, 169 | "allow_on_submit": 0, 170 | "bold": 0, 171 | "collapsible": 0, 172 | "columns": 0, 173 | "fieldname": "active_menu", 174 | "fieldtype": "Link", 175 | "hidden": 0, 176 | "ignore_user_permissions": 0, 177 | "ignore_xss_filter": 0, 178 | "in_filter": 0, 179 | "in_global_search": 0, 180 | "in_list_view": 0, 181 | "in_standard_filter": 0, 182 | "label": "Active Menu", 183 | "length": 0, 184 | "no_copy": 0, 185 | "options": "Restaurant Menu", 186 | "permlevel": 0, 187 | "precision": "", 188 | "print_hide": 0, 189 | "print_hide_if_no_value": 0, 190 | "read_only": 0, 191 | "remember_last_selected_value": 0, 192 | "report_hide": 0, 193 | "reqd": 0, 194 | "search_index": 0, 195 | "set_only_once": 0, 196 | "unique": 0 197 | }, 198 | { 199 | "allow_bulk_edit": 0, 200 | "allow_on_submit": 0, 201 | "bold": 0, 202 | "collapsible": 0, 203 | "columns": 0, 204 | "fieldname": "default_tax_template", 205 | "fieldtype": "Link", 206 | "hidden": 0, 207 | "ignore_user_permissions": 0, 208 | "ignore_xss_filter": 0, 209 | "in_filter": 0, 210 | "in_global_search": 0, 211 | "in_list_view": 0, 212 | "in_standard_filter": 0, 213 | "label": "Default Tax Template", 214 | "length": 0, 215 | "no_copy": 0, 216 | "options": "Sales Taxes and Charges Template", 217 | "permlevel": 0, 218 | "precision": "", 219 | "print_hide": 0, 220 | "print_hide_if_no_value": 0, 221 | "read_only": 0, 222 | "remember_last_selected_value": 0, 223 | "report_hide": 0, 224 | "reqd": 0, 225 | "search_index": 0, 226 | "set_only_once": 0, 227 | "unique": 0 228 | }, 229 | { 230 | "allow_bulk_edit": 0, 231 | "allow_on_submit": 0, 232 | "bold": 0, 233 | "collapsible": 0, 234 | "columns": 0, 235 | "fieldname": "address", 236 | "fieldtype": "Link", 237 | "hidden": 0, 238 | "ignore_user_permissions": 0, 239 | "ignore_xss_filter": 0, 240 | "in_filter": 0, 241 | "in_global_search": 0, 242 | "in_list_view": 0, 243 | "in_standard_filter": 0, 244 | "label": "Address", 245 | "length": 0, 246 | "no_copy": 0, 247 | "options": "Address", 248 | "permlevel": 0, 249 | "precision": "", 250 | "print_hide": 0, 251 | "print_hide_if_no_value": 0, 252 | "read_only": 0, 253 | "remember_last_selected_value": 0, 254 | "report_hide": 0, 255 | "reqd": 0, 256 | "search_index": 0, 257 | "set_only_once": 0, 258 | "unique": 0 259 | } 260 | ], 261 | "has_web_view": 0, 262 | "hide_heading": 0, 263 | "hide_toolbar": 0, 264 | "idx": 0, 265 | "image_field": "image", 266 | "image_view": 0, 267 | "in_create": 0, 268 | "is_submittable": 0, 269 | "issingle": 0, 270 | "istable": 0, 271 | "max_attachments": 0, 272 | "modified": "2017-12-09 12:13:10.185496", 273 | "modified_by": "Administrator", 274 | "module": "Restaurant", 275 | "name": "Restaurant", 276 | "name_case": "", 277 | "owner": "Administrator", 278 | "permissions": [ 279 | { 280 | "amend": 0, 281 | "apply_user_permissions": 0, 282 | "cancel": 0, 283 | "create": 1, 284 | "delete": 1, 285 | "email": 1, 286 | "export": 1, 287 | "if_owner": 0, 288 | "import": 0, 289 | "permlevel": 0, 290 | "print": 1, 291 | "read": 1, 292 | "report": 1, 293 | "role": "System Manager", 294 | "set_user_permissions": 0, 295 | "share": 1, 296 | "submit": 0, 297 | "write": 1 298 | } 299 | ], 300 | "quick_entry": 0, 301 | "read_only": 0, 302 | "read_only_onload": 0, 303 | "restrict_to_domain": "Hospitality", 304 | "show_name_in_global_search": 0, 305 | "sort_field": "modified", 306 | "sort_order": "DESC", 307 | "track_changes": 1, 308 | "track_seen": 0 309 | } -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant/restaurant.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class Restaurant(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant/restaurant_dashboard.py: -------------------------------------------------------------------------------- 1 | from frappe import _ 2 | 3 | 4 | def get_data(): 5 | return { 6 | 'fieldname': 'restaurant', 7 | 'transactions': [ 8 | { 9 | 'label': _('Setup'), 10 | 'items': ['Restaurant Menu', 'Restaurant Table'] 11 | }, 12 | { 13 | 'label': _('Operations'), 14 | 'items': ['Restaurant Reservation', 'Sales Invoice'] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant/test_restaurant.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | test_records = [ 7 | dict(doctype='Restaurant', name='Test Restaurant 1', company='_Test Company 1', 8 | invoice_series_prefix='Test-Rest-1-Inv-', default_customer='_Test Customer 1'), 9 | dict(doctype='Restaurant', name='Test Restaurant 2', company='_Test Company 1', 10 | invoice_series_prefix='Test-Rest-2-Inv-', default_customer='_Test Customer 1'), 11 | ] 12 | 13 | class TestRestaurant(unittest.TestCase): 14 | pass 15 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_menu/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/doctype/restaurant_menu/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_menu/restaurant_menu.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Restaurant Menu', { 5 | setup: function(frm) { 6 | frm.add_fetch('item', 'standard_rate', 'rate'); 7 | }, 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_menu/restaurant_menu.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "prompt", 7 | "beta": 1, 8 | "creation": "2017-09-15 12:48:29.818715", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "restaurant", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 0, 30 | "in_standard_filter": 0, 31 | "label": "Restaurant", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Restaurant", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "default": "1", 54 | "fieldname": "enabled", 55 | "fieldtype": "Check", 56 | "hidden": 0, 57 | "ignore_user_permissions": 0, 58 | "ignore_xss_filter": 0, 59 | "in_filter": 0, 60 | "in_global_search": 0, 61 | "in_list_view": 1, 62 | "in_standard_filter": 0, 63 | "label": "Enabled", 64 | "length": 0, 65 | "no_copy": 0, 66 | "permlevel": 0, 67 | "precision": "", 68 | "print_hide": 0, 69 | "print_hide_if_no_value": 0, 70 | "read_only": 0, 71 | "remember_last_selected_value": 0, 72 | "report_hide": 0, 73 | "reqd": 0, 74 | "search_index": 0, 75 | "set_only_once": 0, 76 | "unique": 0 77 | }, 78 | { 79 | "allow_bulk_edit": 0, 80 | "allow_on_submit": 0, 81 | "bold": 0, 82 | "collapsible": 0, 83 | "columns": 0, 84 | "fieldname": "column_break_3", 85 | "fieldtype": "Column Break", 86 | "hidden": 0, 87 | "ignore_user_permissions": 0, 88 | "ignore_xss_filter": 0, 89 | "in_filter": 0, 90 | "in_global_search": 0, 91 | "in_list_view": 0, 92 | "in_standard_filter": 0, 93 | "length": 0, 94 | "no_copy": 0, 95 | "permlevel": 0, 96 | "precision": "", 97 | "print_hide": 0, 98 | "print_hide_if_no_value": 0, 99 | "read_only": 0, 100 | "remember_last_selected_value": 0, 101 | "report_hide": 0, 102 | "reqd": 0, 103 | "search_index": 0, 104 | "set_only_once": 0, 105 | "unique": 0 106 | }, 107 | { 108 | "allow_bulk_edit": 0, 109 | "allow_on_submit": 0, 110 | "bold": 0, 111 | "collapsible": 0, 112 | "columns": 0, 113 | "fieldname": "price_list", 114 | "fieldtype": "Link", 115 | "hidden": 0, 116 | "ignore_user_permissions": 0, 117 | "ignore_xss_filter": 0, 118 | "in_filter": 0, 119 | "in_global_search": 0, 120 | "in_list_view": 0, 121 | "in_standard_filter": 0, 122 | "label": "Price List (Auto created)", 123 | "length": 0, 124 | "no_copy": 0, 125 | "options": "Price List", 126 | "permlevel": 0, 127 | "precision": "", 128 | "print_hide": 0, 129 | "print_hide_if_no_value": 0, 130 | "read_only": 1, 131 | "remember_last_selected_value": 0, 132 | "report_hide": 0, 133 | "reqd": 0, 134 | "search_index": 0, 135 | "set_only_once": 0, 136 | "unique": 0 137 | }, 138 | { 139 | "allow_bulk_edit": 0, 140 | "allow_on_submit": 0, 141 | "bold": 0, 142 | "collapsible": 0, 143 | "columns": 0, 144 | "fieldname": "items_section", 145 | "fieldtype": "Section Break", 146 | "hidden": 0, 147 | "ignore_user_permissions": 0, 148 | "ignore_xss_filter": 0, 149 | "in_filter": 0, 150 | "in_global_search": 0, 151 | "in_list_view": 0, 152 | "in_standard_filter": 0, 153 | "label": "Items", 154 | "length": 0, 155 | "no_copy": 0, 156 | "permlevel": 0, 157 | "precision": "", 158 | "print_hide": 0, 159 | "print_hide_if_no_value": 0, 160 | "read_only": 0, 161 | "remember_last_selected_value": 0, 162 | "report_hide": 0, 163 | "reqd": 0, 164 | "search_index": 0, 165 | "set_only_once": 0, 166 | "unique": 0 167 | }, 168 | { 169 | "allow_bulk_edit": 0, 170 | "allow_on_submit": 0, 171 | "bold": 0, 172 | "collapsible": 0, 173 | "columns": 0, 174 | "fieldname": "items", 175 | "fieldtype": "Table", 176 | "hidden": 0, 177 | "ignore_user_permissions": 0, 178 | "ignore_xss_filter": 0, 179 | "in_filter": 0, 180 | "in_global_search": 0, 181 | "in_list_view": 0, 182 | "in_standard_filter": 0, 183 | "label": "Items", 184 | "length": 0, 185 | "no_copy": 0, 186 | "options": "Restaurant Menu Item", 187 | "permlevel": 0, 188 | "precision": "", 189 | "print_hide": 0, 190 | "print_hide_if_no_value": 0, 191 | "read_only": 0, 192 | "remember_last_selected_value": 0, 193 | "report_hide": 0, 194 | "reqd": 1, 195 | "search_index": 0, 196 | "set_only_once": 0, 197 | "unique": 0 198 | } 199 | ], 200 | "has_web_view": 0, 201 | "hide_heading": 0, 202 | "hide_toolbar": 0, 203 | "idx": 0, 204 | "image_view": 0, 205 | "in_create": 0, 206 | "is_submittable": 0, 207 | "issingle": 0, 208 | "istable": 0, 209 | "max_attachments": 0, 210 | "modified": "2017-12-09 12:13:13.684500", 211 | "modified_by": "Administrator", 212 | "module": "Restaurant", 213 | "name": "Restaurant Menu", 214 | "name_case": "", 215 | "owner": "Administrator", 216 | "permissions": [ 217 | { 218 | "amend": 0, 219 | "apply_user_permissions": 0, 220 | "cancel": 0, 221 | "create": 1, 222 | "delete": 1, 223 | "email": 1, 224 | "export": 1, 225 | "if_owner": 0, 226 | "import": 0, 227 | "permlevel": 0, 228 | "print": 1, 229 | "read": 1, 230 | "report": 1, 231 | "role": "Restaurant Manager", 232 | "set_user_permissions": 0, 233 | "share": 1, 234 | "submit": 0, 235 | "write": 1 236 | } 237 | ], 238 | "quick_entry": 1, 239 | "read_only": 0, 240 | "read_only_onload": 0, 241 | "restrict_to_domain": "Hospitality", 242 | "show_name_in_global_search": 0, 243 | "sort_field": "modified", 244 | "sort_order": "DESC", 245 | "track_changes": 1, 246 | "track_seen": 0 247 | } -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_menu/restaurant_menu.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import frappe 6 | from frappe.model.document import Document 7 | 8 | 9 | class RestaurantMenu(Document): 10 | def validate(self): 11 | for d in self.items: 12 | if not d.rate: 13 | d.rate = frappe.db.get_value('Item', d.item, 'standard_rate') 14 | 15 | def on_update(self): 16 | '''Sync Price List''' 17 | self.make_price_list() 18 | 19 | def on_trash(self): 20 | '''clear prices''' 21 | self.clear_item_price() 22 | 23 | def clear_item_price(self, price_list=None): 24 | '''clear all item prices for this menu''' 25 | if not price_list: 26 | price_list = self.get_price_list().name 27 | frappe.db.sql('delete from `tabItem Price` where price_list = %s', price_list) 28 | 29 | def make_price_list(self): 30 | # create price list for menu 31 | price_list = self.get_price_list() 32 | self.db_set('price_list', price_list.name) 33 | 34 | # delete old items 35 | self.clear_item_price(price_list.name) 36 | 37 | for d in self.items: 38 | frappe.get_doc(dict( 39 | doctype = 'Item Price', 40 | price_list = price_list.name, 41 | item_code = d.item, 42 | price_list_rate = d.rate 43 | )).insert() 44 | 45 | def get_price_list(self): 46 | '''Create price list for menu if missing''' 47 | price_list_name = frappe.db.get_value('Price List', dict(restaurant_menu=self.name)) 48 | if price_list_name: 49 | price_list = frappe.get_doc('Price List', price_list_name) 50 | else: 51 | price_list = frappe.new_doc('Price List') 52 | price_list.restaurant_menu = self.name 53 | price_list.price_list_name = self.name 54 | 55 | price_list.enabled = 1 56 | price_list.selling = 1 57 | price_list.save() 58 | 59 | return price_list 60 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_menu/test_restaurant_menu.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | import frappe 7 | 8 | test_records = [ 9 | dict(doctype='Item', item_code='Food Item 1', 10 | item_group='Products', is_stock_item=0), 11 | dict(doctype='Item', item_code='Food Item 2', 12 | item_group='Products', is_stock_item=0), 13 | dict(doctype='Item', item_code='Food Item 3', 14 | item_group='Products', is_stock_item=0), 15 | dict(doctype='Item', item_code='Food Item 4', 16 | item_group='Products', is_stock_item=0), 17 | dict(doctype='Restaurant Menu', restaurant='Test Restaurant 1', name='Test Restaurant 1 Menu 1', 18 | items = [ 19 | dict(item='Food Item 1', rate=400), 20 | dict(item='Food Item 2', rate=300), 21 | dict(item='Food Item 3', rate=200), 22 | dict(item='Food Item 4', rate=100), 23 | ]), 24 | dict(doctype='Restaurant Menu', restaurant='Test Restaurant 1', name='Test Restaurant 1 Menu 2', 25 | items = [ 26 | dict(item='Food Item 1', rate=450), 27 | dict(item='Food Item 2', rate=350), 28 | ]) 29 | ] 30 | 31 | class TestRestaurantMenu(unittest.TestCase): 32 | def test_price_list_creation_and_editing(self): 33 | menu1 = frappe.get_doc('Restaurant Menu', 'Test Restaurant 1 Menu 1') 34 | menu1.save() 35 | 36 | menu2 = frappe.get_doc('Restaurant Menu', 'Test Restaurant 1 Menu 2') 37 | menu2.save() 38 | 39 | self.assertTrue(frappe.db.get_value('Price List', 'Test Restaurant 1 Menu 1')) 40 | self.assertEqual(frappe.db.get_value('Item Price', 41 | dict(price_list = 'Test Restaurant 1 Menu 1', item_code='Food Item 1'), 'price_list_rate'), 400) 42 | self.assertEqual(frappe.db.get_value('Item Price', 43 | dict(price_list = 'Test Restaurant 1 Menu 2', item_code='Food Item 1'), 'price_list_rate'), 450) 44 | 45 | menu1.items[0].rate = 401 46 | menu1.save() 47 | 48 | self.assertEqual(frappe.db.get_value('Item Price', 49 | dict(price_list = 'Test Restaurant 1 Menu 1', item_code='Food Item 1'), 'price_list_rate'), 401) 50 | 51 | menu1.items[0].rate = 400 52 | menu1.save() 53 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_menu_item/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/doctype/restaurant_menu_item/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_menu_item/restaurant_menu_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "", 7 | "beta": 0, 8 | "creation": "2017-09-15 12:49:36.072636", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "item", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 1, 30 | "in_standard_filter": 0, 31 | "label": "Item", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Item", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "rate", 54 | "fieldtype": "Currency", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 1, 61 | "in_standard_filter": 0, 62 | "label": "Rate", 63 | "length": 0, 64 | "no_copy": 0, 65 | "options": "", 66 | "permlevel": 0, 67 | "precision": "", 68 | "print_hide": 0, 69 | "print_hide_if_no_value": 0, 70 | "read_only": 0, 71 | "remember_last_selected_value": 0, 72 | "report_hide": 0, 73 | "reqd": 0, 74 | "search_index": 0, 75 | "set_only_once": 0, 76 | "unique": 0 77 | } 78 | ], 79 | "has_web_view": 0, 80 | "hide_heading": 0, 81 | "hide_toolbar": 0, 82 | "idx": 0, 83 | "image_view": 0, 84 | "in_create": 0, 85 | "is_submittable": 0, 86 | "issingle": 0, 87 | "istable": 1, 88 | "max_attachments": 0, 89 | "modified": "2017-09-15 14:18:55.145088", 90 | "modified_by": "Administrator", 91 | "module": "Restaurant", 92 | "name": "Restaurant Menu Item", 93 | "name_case": "", 94 | "owner": "Administrator", 95 | "permissions": [], 96 | "quick_entry": 1, 97 | "read_only": 0, 98 | "read_only_onload": 0, 99 | "restrict_to_domain": "Hospitality", 100 | "show_name_in_global_search": 0, 101 | "sort_field": "modified", 102 | "sort_order": "DESC", 103 | "track_changes": 1, 104 | "track_seen": 0 105 | } -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_menu_item/restaurant_menu_item.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class RestaurantMenuItem(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_order_entry/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/doctype/restaurant_order_entry/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Restaurant Order Entry', { 5 | setup: function(frm) { 6 | let get_item_query = () => { 7 | return { 8 | query: 'hospitality.restaurant.doctype.restaurant_order_entry.restaurant_order_entry.item_query_restaurant', 9 | filters: { 10 | 'table': frm.doc.restaurant_table 11 | } 12 | }; 13 | }; 14 | frm.set_query('item', 'items', get_item_query); 15 | frm.set_query('add_item', get_item_query); 16 | }, 17 | onload_post_render: function(frm) { 18 | if(!frm.item_selector) { 19 | frm.item_selector = new erpnext.ItemSelector({ 20 | frm: frm, 21 | item_field: 'item', 22 | item_query: 'hospitality.restaurant.doctype.restaurant_order_entry.restaurant_order_entry.item_query_restaurant', 23 | get_filters: () => { 24 | return {table: frm.doc.restaurant_table}; 25 | } 26 | }); 27 | } 28 | 29 | let $input = frm.get_field('add_item').$input; 30 | 31 | $input.on('keyup', function(e) { 32 | if (e.which===13) { 33 | if (frm.clear_item_timeout) { 34 | clearTimeout (frm.clear_item_timeout); 35 | } 36 | 37 | // clear the item input so user can enter a new item 38 | frm.clear_item_timeout = setTimeout (() => { 39 | frm.set_value('add_item', ''); 40 | }, 1000); 41 | 42 | let item = $input.val(); 43 | 44 | if (!item) return; 45 | 46 | var added = false; 47 | (frm.doc.items || []).forEach((d) => { 48 | if (d.item===item) { 49 | d.qty += 1; 50 | added = true; 51 | } 52 | }); 53 | 54 | return frappe.run_serially([ 55 | () => { 56 | if (!added) { 57 | return frm.add_child('items', {item: item, qty: 1}); 58 | } 59 | }, 60 | () => frm.get_field("items").refresh() 61 | ]); 62 | } 63 | }); 64 | }, 65 | refresh: function(frm) { 66 | frm.disable_save(); 67 | frm.add_custom_button(__('Update'), () => { 68 | return frm.trigger('sync'); 69 | }); 70 | frm.add_custom_button(__('Clear'), () => { 71 | return frm.trigger('clear'); 72 | }); 73 | frm.add_custom_button(__('Bill'), () => { 74 | return frm.trigger('make_invoice'); 75 | }); 76 | }, 77 | clear: function(frm) { 78 | frm.doc.add_item = ''; 79 | frm.doc.grand_total = 0; 80 | frm.doc.items = []; 81 | frm.refresh(); 82 | frm.get_field('add_item').$input.focus(); 83 | }, 84 | restaurant_table: function(frm) { 85 | // select the open sales order items for this table 86 | if (!frm.doc.restaurant_table) { 87 | return; 88 | } 89 | return frappe.call({ 90 | method: 'hospitality.restaurant.doctype.restaurant_order_entry.restaurant_order_entry.get_invoice', 91 | args: { 92 | table: frm.doc.restaurant_table 93 | }, 94 | callback: (r) => { 95 | frm.events.set_invoice_items(frm, r); 96 | } 97 | }); 98 | }, 99 | sync: function(frm) { 100 | return frappe.call({ 101 | method: 'hospitality.restaurant.doctype.restaurant_order_entry.restaurant_order_entry.sync', 102 | args: { 103 | table: frm.doc.restaurant_table, 104 | items: frm.doc.items 105 | }, 106 | callback: (r) => { 107 | frm.events.set_invoice_items(frm, r); 108 | frappe.show_alert({message: __('Saved'), indicator: 'green'}); 109 | } 110 | }); 111 | 112 | }, 113 | make_invoice: function(frm) { 114 | frm.trigger('sync').then(() => { 115 | frappe.prompt([ 116 | { 117 | fieldname: 'customer', 118 | label: __('Customer'), 119 | fieldtype: 'Link', 120 | reqd: 1, 121 | options: 'Customer', 122 | 'default': frm.invoice.customer 123 | }, 124 | { 125 | fieldname: 'mode_of_payment', 126 | label: __('Mode of Payment'), 127 | fieldtype: 'Link', 128 | reqd: 1, 129 | options: 'Mode of Payment', 130 | 'default': frm.mode_of_payment || '' 131 | } 132 | ], (data) => { 133 | // cache this for next entry 134 | frm.mode_of_payment = data.mode_of_payment; 135 | return frappe.call({ 136 | method: 'hospitality.restaurant.doctype.restaurant_order_entry.restaurant_order_entry.make_invoice', 137 | args: { 138 | table: frm.doc.restaurant_table, 139 | customer: data.customer, 140 | mode_of_payment: data.mode_of_payment 141 | }, 142 | callback: (r) => { 143 | frm.set_value('last_sales_invoice', r.message); 144 | frm.trigger('clear'); 145 | } 146 | }); 147 | }, 148 | __("Select Customer")); 149 | }); 150 | }, 151 | set_invoice_items: function(frm, r) { 152 | let invoice = r.message; 153 | frm.doc.items = []; 154 | (invoice.items || []).forEach((d) => { 155 | frm.add_child('items', {item: d.item_code, qty: d.qty, rate: d.rate}); 156 | }); 157 | frm.set_value('grand_total', invoice.grand_total); 158 | frm.set_value('last_sales_invoice', invoice.name); 159 | frm.invoice = invoice; 160 | frm.refresh(); 161 | } 162 | }); 163 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "beta": 1, 7 | "creation": "2017-09-15 15:10:24.530365", 8 | "custom": 0, 9 | "docstatus": 0, 10 | "doctype": "DocType", 11 | "document_type": "", 12 | "editable_grid": 1, 13 | "engine": "InnoDB", 14 | "fields": [ 15 | { 16 | "allow_bulk_edit": 0, 17 | "allow_on_submit": 0, 18 | "bold": 0, 19 | "collapsible": 0, 20 | "columns": 0, 21 | "fieldname": "restaurant_table", 22 | "fieldtype": "Link", 23 | "hidden": 0, 24 | "ignore_user_permissions": 0, 25 | "ignore_xss_filter": 0, 26 | "in_filter": 0, 27 | "in_global_search": 0, 28 | "in_list_view": 0, 29 | "in_standard_filter": 0, 30 | "label": "Restaurant Table", 31 | "length": 0, 32 | "no_copy": 0, 33 | "options": "Restaurant Table", 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 0, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "depends_on": "restaurant_table", 53 | "description": "Click Enter To Add", 54 | "fieldname": "add_item", 55 | "fieldtype": "Link", 56 | "hidden": 0, 57 | "ignore_user_permissions": 0, 58 | "ignore_xss_filter": 0, 59 | "in_filter": 0, 60 | "in_global_search": 0, 61 | "in_list_view": 0, 62 | "in_standard_filter": 0, 63 | "label": "Add Item", 64 | "length": 0, 65 | "no_copy": 0, 66 | "options": "Item", 67 | "permlevel": 0, 68 | "precision": "", 69 | "print_hide": 0, 70 | "print_hide_if_no_value": 0, 71 | "read_only": 0, 72 | "remember_last_selected_value": 0, 73 | "report_hide": 0, 74 | "reqd": 0, 75 | "search_index": 0, 76 | "set_only_once": 0, 77 | "unique": 0 78 | }, 79 | { 80 | "allow_bulk_edit": 0, 81 | "allow_on_submit": 0, 82 | "bold": 0, 83 | "collapsible": 0, 84 | "columns": 0, 85 | "fieldname": "column_break_3", 86 | "fieldtype": "Column Break", 87 | "hidden": 0, 88 | "ignore_user_permissions": 0, 89 | "ignore_xss_filter": 0, 90 | "in_filter": 0, 91 | "in_global_search": 0, 92 | "in_list_view": 0, 93 | "in_standard_filter": 0, 94 | "length": 0, 95 | "no_copy": 0, 96 | "permlevel": 0, 97 | "precision": "", 98 | "print_hide": 0, 99 | "print_hide_if_no_value": 0, 100 | "read_only": 0, 101 | "remember_last_selected_value": 0, 102 | "report_hide": 0, 103 | "reqd": 0, 104 | "search_index": 0, 105 | "set_only_once": 0, 106 | "unique": 0 107 | }, 108 | { 109 | "allow_bulk_edit": 0, 110 | "allow_on_submit": 0, 111 | "bold": 0, 112 | "collapsible": 0, 113 | "columns": 0, 114 | "fieldname": "grand_total", 115 | "fieldtype": "Currency", 116 | "hidden": 0, 117 | "ignore_user_permissions": 0, 118 | "ignore_xss_filter": 0, 119 | "in_filter": 0, 120 | "in_global_search": 0, 121 | "in_list_view": 0, 122 | "in_standard_filter": 0, 123 | "label": "Grand Total", 124 | "length": 0, 125 | "no_copy": 0, 126 | "permlevel": 0, 127 | "precision": "", 128 | "print_hide": 0, 129 | "print_hide_if_no_value": 0, 130 | "read_only": 1, 131 | "remember_last_selected_value": 0, 132 | "report_hide": 0, 133 | "reqd": 0, 134 | "search_index": 0, 135 | "set_only_once": 0, 136 | "unique": 0 137 | }, 138 | { 139 | "allow_bulk_edit": 0, 140 | "allow_on_submit": 0, 141 | "bold": 0, 142 | "collapsible": 0, 143 | "columns": 0, 144 | "fieldname": "last_sales_invoice", 145 | "fieldtype": "Link", 146 | "hidden": 0, 147 | "ignore_user_permissions": 0, 148 | "ignore_xss_filter": 0, 149 | "in_filter": 0, 150 | "in_global_search": 0, 151 | "in_list_view": 0, 152 | "in_standard_filter": 0, 153 | "label": "Last Sales Invoice", 154 | "length": 0, 155 | "no_copy": 0, 156 | "options": "Sales Invoice", 157 | "permlevel": 0, 158 | "precision": "", 159 | "print_hide": 0, 160 | "print_hide_if_no_value": 0, 161 | "read_only": 1, 162 | "remember_last_selected_value": 0, 163 | "report_hide": 0, 164 | "reqd": 0, 165 | "search_index": 0, 166 | "set_only_once": 0, 167 | "unique": 0 168 | }, 169 | { 170 | "allow_bulk_edit": 0, 171 | "allow_on_submit": 0, 172 | "bold": 0, 173 | "collapsible": 0, 174 | "columns": 0, 175 | "depends_on": "restaurant_table", 176 | "fieldname": "current_order", 177 | "fieldtype": "Section Break", 178 | "hidden": 0, 179 | "ignore_user_permissions": 0, 180 | "ignore_xss_filter": 0, 181 | "in_filter": 0, 182 | "in_global_search": 0, 183 | "in_list_view": 0, 184 | "in_standard_filter": 0, 185 | "label": "Current Order", 186 | "length": 0, 187 | "no_copy": 0, 188 | "permlevel": 0, 189 | "precision": "", 190 | "print_hide": 0, 191 | "print_hide_if_no_value": 0, 192 | "read_only": 0, 193 | "remember_last_selected_value": 0, 194 | "report_hide": 0, 195 | "reqd": 0, 196 | "search_index": 0, 197 | "set_only_once": 0, 198 | "unique": 0 199 | }, 200 | { 201 | "allow_bulk_edit": 0, 202 | "allow_on_submit": 0, 203 | "bold": 0, 204 | "collapsible": 0, 205 | "columns": 0, 206 | "depends_on": "restaurant_table", 207 | "fieldname": "items", 208 | "fieldtype": "Table", 209 | "hidden": 0, 210 | "ignore_user_permissions": 0, 211 | "ignore_xss_filter": 0, 212 | "in_filter": 0, 213 | "in_global_search": 0, 214 | "in_list_view": 0, 215 | "in_standard_filter": 0, 216 | "label": "Items", 217 | "length": 0, 218 | "no_copy": 0, 219 | "options": "Restaurant Order Entry Item", 220 | "permlevel": 0, 221 | "precision": "", 222 | "print_hide": 0, 223 | "print_hide_if_no_value": 0, 224 | "read_only": 0, 225 | "remember_last_selected_value": 0, 226 | "report_hide": 0, 227 | "reqd": 0, 228 | "search_index": 0, 229 | "set_only_once": 0, 230 | "unique": 0 231 | } 232 | ], 233 | "has_web_view": 0, 234 | "hide_heading": 0, 235 | "hide_toolbar": 0, 236 | "idx": 0, 237 | "image_view": 0, 238 | "in_create": 0, 239 | "is_submittable": 0, 240 | "issingle": 1, 241 | "istable": 0, 242 | "max_attachments": 0, 243 | "modified": "2017-10-04 17:06:20.926999", 244 | "modified_by": "Administrator", 245 | "module": "Restaurant", 246 | "name": "Restaurant Order Entry", 247 | "name_case": "", 248 | "owner": "Administrator", 249 | "permissions": [ 250 | { 251 | "amend": 0, 252 | "apply_user_permissions": 0, 253 | "cancel": 0, 254 | "create": 1, 255 | "delete": 1, 256 | "email": 1, 257 | "export": 0, 258 | "if_owner": 0, 259 | "import": 0, 260 | "permlevel": 0, 261 | "print": 1, 262 | "read": 1, 263 | "report": 0, 264 | "role": "Restaurant Manager", 265 | "set_user_permissions": 0, 266 | "share": 1, 267 | "submit": 0, 268 | "write": 1 269 | } 270 | ], 271 | "quick_entry": 1, 272 | "read_only": 0, 273 | "read_only_onload": 0, 274 | "restrict_to_domain": "Hospitality", 275 | "show_name_in_global_search": 0, 276 | "sort_field": "modified", 277 | "sort_order": "DESC", 278 | "track_changes": 1, 279 | "track_seen": 0 280 | } -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import json 6 | 7 | import frappe 8 | from frappe import _ 9 | from frappe.model.document import Document 10 | 11 | from erpnext.controllers.queries import item_query 12 | 13 | 14 | class RestaurantOrderEntry(Document): 15 | pass 16 | 17 | @frappe.whitelist() 18 | def get_invoice(table): 19 | '''returns the active invoice linked to the given table''' 20 | invoice_name = frappe.get_value('Sales Invoice', dict(restaurant_table = table, docstatus=0)) 21 | restaurant, menu_name = get_restaurant_and_menu_name(table) 22 | if invoice_name: 23 | invoice = frappe.get_doc('Sales Invoice', invoice_name) 24 | else: 25 | invoice = frappe.new_doc('Sales Invoice') 26 | invoice.naming_series = frappe.db.get_value('Restaurant', restaurant, 'invoice_series_prefix') 27 | invoice.is_pos = 1 28 | default_customer = frappe.db.get_value('Restaurant', restaurant, 'default_customer') 29 | if not default_customer: 30 | frappe.throw(_('Please set default customer in Restaurant Settings')) 31 | invoice.customer = default_customer 32 | 33 | invoice.taxes_and_charges = frappe.db.get_value('Restaurant', restaurant, 'default_tax_template') 34 | invoice.selling_price_list = frappe.db.get_value('Price List', dict(restaurant_menu=menu_name, enabled=1)) 35 | 36 | return invoice 37 | 38 | @frappe.whitelist() 39 | def sync(table, items): 40 | '''Sync the sales order related to the table''' 41 | invoice = get_invoice(table) 42 | items = json.loads(items) 43 | 44 | invoice.items = [] 45 | invoice.restaurant_table = table 46 | for d in items: 47 | invoice.append('items', dict( 48 | item_code = d.get('item'), 49 | qty = d.get('qty') 50 | )) 51 | 52 | invoice.save() 53 | return invoice.as_dict() 54 | 55 | @frappe.whitelist() 56 | def make_invoice(table, customer, mode_of_payment): 57 | '''Make table based on Sales Order''' 58 | restaurant, menu = get_restaurant_and_menu_name(table) 59 | invoice = get_invoice(table) 60 | invoice.customer = customer 61 | invoice.restaurant = restaurant 62 | invoice.calculate_taxes_and_totals() 63 | invoice.append('payments', dict(mode_of_payment=mode_of_payment, amount=invoice.grand_total)) 64 | invoice.save() 65 | invoice.submit() 66 | 67 | frappe.msgprint(_('Invoice Created'), indicator='green', alert=True) 68 | 69 | return invoice.name 70 | 71 | @frappe.whitelist() 72 | def item_query_restaurant(doctype='Item', txt='', searchfield='name', start=0, page_len=20, filters=None, as_dict=False): 73 | '''Return items that are selected in active menu of the restaurant''' 74 | restaurant, menu = get_restaurant_and_menu_name(filters['table']) 75 | items = frappe.db.get_all('Restaurant Menu Item', ['item'], dict(parent = menu)) 76 | del filters['table'] 77 | filters['name'] = ('in', [d.item for d in items]) 78 | 79 | return item_query('Item', txt, searchfield, start, page_len, filters, as_dict) 80 | 81 | def get_restaurant_and_menu_name(table): 82 | if not table: 83 | frappe.throw(_('Please select a table')) 84 | 85 | restaurant = frappe.db.get_value('Restaurant Table', table, 'restaurant') 86 | menu = frappe.db.get_value('Restaurant', restaurant, 'active_menu') 87 | 88 | if not menu: 89 | frappe.throw(_('Please set an active menu for Restaurant {0}').format(restaurant)) 90 | 91 | return restaurant, menu 92 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_order_entry_item/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/doctype/restaurant_order_entry_item/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_order_entry_item/restaurant_order_entry_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "beta": 0, 7 | "creation": "2017-09-15 15:11:50.313241", 8 | "custom": 0, 9 | "docstatus": 0, 10 | "doctype": "DocType", 11 | "document_type": "", 12 | "editable_grid": 1, 13 | "engine": "InnoDB", 14 | "fields": [ 15 | { 16 | "allow_bulk_edit": 0, 17 | "allow_on_submit": 0, 18 | "bold": 0, 19 | "collapsible": 0, 20 | "columns": 0, 21 | "fieldname": "item", 22 | "fieldtype": "Link", 23 | "hidden": 0, 24 | "ignore_user_permissions": 0, 25 | "ignore_xss_filter": 0, 26 | "in_filter": 0, 27 | "in_global_search": 0, 28 | "in_list_view": 1, 29 | "in_standard_filter": 0, 30 | "label": "Item", 31 | "length": 0, 32 | "no_copy": 0, 33 | "options": "Item", 34 | "permlevel": 0, 35 | "precision": "", 36 | "print_hide": 0, 37 | "print_hide_if_no_value": 0, 38 | "read_only": 0, 39 | "remember_last_selected_value": 0, 40 | "report_hide": 0, 41 | "reqd": 1, 42 | "search_index": 0, 43 | "set_only_once": 0, 44 | "unique": 0 45 | }, 46 | { 47 | "allow_bulk_edit": 0, 48 | "allow_on_submit": 0, 49 | "bold": 0, 50 | "collapsible": 0, 51 | "columns": 0, 52 | "fieldname": "qty", 53 | "fieldtype": "Int", 54 | "hidden": 0, 55 | "ignore_user_permissions": 0, 56 | "ignore_xss_filter": 0, 57 | "in_filter": 0, 58 | "in_global_search": 0, 59 | "in_list_view": 1, 60 | "in_standard_filter": 0, 61 | "label": "Qty", 62 | "length": 0, 63 | "no_copy": 0, 64 | "permlevel": 0, 65 | "precision": "", 66 | "print_hide": 0, 67 | "print_hide_if_no_value": 0, 68 | "read_only": 0, 69 | "remember_last_selected_value": 0, 70 | "report_hide": 0, 71 | "reqd": 1, 72 | "search_index": 0, 73 | "set_only_once": 0, 74 | "unique": 0 75 | }, 76 | { 77 | "allow_bulk_edit": 0, 78 | "allow_on_submit": 0, 79 | "bold": 0, 80 | "collapsible": 0, 81 | "columns": 0, 82 | "fieldname": "served", 83 | "fieldtype": "Int", 84 | "hidden": 0, 85 | "ignore_user_permissions": 0, 86 | "ignore_xss_filter": 0, 87 | "in_filter": 0, 88 | "in_global_search": 0, 89 | "in_list_view": 1, 90 | "in_standard_filter": 0, 91 | "label": "Served", 92 | "length": 0, 93 | "no_copy": 0, 94 | "permlevel": 0, 95 | "precision": "", 96 | "print_hide": 0, 97 | "print_hide_if_no_value": 0, 98 | "read_only": 0, 99 | "remember_last_selected_value": 0, 100 | "report_hide": 0, 101 | "reqd": 0, 102 | "search_index": 0, 103 | "set_only_once": 0, 104 | "unique": 0 105 | }, 106 | { 107 | "allow_bulk_edit": 0, 108 | "allow_on_submit": 0, 109 | "bold": 0, 110 | "collapsible": 0, 111 | "columns": 0, 112 | "fieldname": "rate", 113 | "fieldtype": "Currency", 114 | "hidden": 0, 115 | "ignore_user_permissions": 0, 116 | "ignore_xss_filter": 0, 117 | "in_filter": 0, 118 | "in_global_search": 0, 119 | "in_list_view": 1, 120 | "in_standard_filter": 0, 121 | "label": "Rate", 122 | "length": 0, 123 | "no_copy": 0, 124 | "permlevel": 0, 125 | "precision": "", 126 | "print_hide": 0, 127 | "print_hide_if_no_value": 0, 128 | "read_only": 0, 129 | "remember_last_selected_value": 0, 130 | "report_hide": 0, 131 | "reqd": 0, 132 | "search_index": 0, 133 | "set_only_once": 0, 134 | "unique": 0 135 | } 136 | ], 137 | "has_web_view": 0, 138 | "hide_heading": 0, 139 | "hide_toolbar": 0, 140 | "idx": 0, 141 | "image_view": 0, 142 | "in_create": 0, 143 | "is_submittable": 0, 144 | "issingle": 0, 145 | "istable": 1, 146 | "max_attachments": 0, 147 | "modified": "2017-09-21 08:39:27.232175", 148 | "modified_by": "Administrator", 149 | "module": "Restaurant", 150 | "name": "Restaurant Order Entry Item", 151 | "name_case": "", 152 | "owner": "Administrator", 153 | "permissions": [], 154 | "quick_entry": 1, 155 | "read_only": 0, 156 | "read_only_onload": 0, 157 | "restrict_to_domain": "Hospitality", 158 | "show_name_in_global_search": 0, 159 | "sort_field": "modified", 160 | "sort_order": "DESC", 161 | "track_changes": 1, 162 | "track_seen": 0 163 | } -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_order_entry_item/restaurant_order_entry_item.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from frappe.model.document import Document 6 | 7 | 8 | class RestaurantOrderEntryItem(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_reservation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/doctype/restaurant_reservation/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_reservation/restaurant_reservation.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Restaurant Reservation', { 5 | setup: function(frm) { 6 | frm.add_fetch('customer', 'customer_name', 'customer_name'); 7 | }, 8 | refresh: function(frm) { 9 | 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_reservation/restaurant_reservation.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "RES-RES-.YYYY.-.#####", 7 | "beta": 1, 8 | "creation": "2017-09-15 13:05:51.063661", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_in_quick_entry": 0, 19 | "allow_on_submit": 0, 20 | "bold": 0, 21 | "collapsible": 0, 22 | "columns": 0, 23 | "fieldname": "status", 24 | "fieldtype": "Select", 25 | "hidden": 0, 26 | "ignore_user_permissions": 0, 27 | "ignore_xss_filter": 0, 28 | "in_filter": 0, 29 | "in_global_search": 0, 30 | "in_list_view": 1, 31 | "in_standard_filter": 0, 32 | "label": "Status", 33 | "length": 0, 34 | "no_copy": 0, 35 | "options": "Open\nWaitlisted\nCancelled\nNo Show\nSuccess", 36 | "permlevel": 0, 37 | "precision": "", 38 | "print_hide": 0, 39 | "print_hide_if_no_value": 0, 40 | "read_only": 0, 41 | "remember_last_selected_value": 0, 42 | "report_hide": 0, 43 | "reqd": 0, 44 | "search_index": 0, 45 | "set_only_once": 0, 46 | "translatable": 0, 47 | "unique": 0 48 | }, 49 | { 50 | "allow_bulk_edit": 0, 51 | "allow_in_quick_entry": 0, 52 | "allow_on_submit": 0, 53 | "bold": 0, 54 | "collapsible": 0, 55 | "columns": 0, 56 | "fieldname": "restaurant", 57 | "fieldtype": "Link", 58 | "hidden": 0, 59 | "ignore_user_permissions": 0, 60 | "ignore_xss_filter": 0, 61 | "in_filter": 0, 62 | "in_global_search": 0, 63 | "in_list_view": 0, 64 | "in_standard_filter": 0, 65 | "label": "Restaurant", 66 | "length": 0, 67 | "no_copy": 0, 68 | "options": "Restaurant", 69 | "permlevel": 0, 70 | "precision": "", 71 | "print_hide": 0, 72 | "print_hide_if_no_value": 0, 73 | "read_only": 0, 74 | "remember_last_selected_value": 0, 75 | "report_hide": 0, 76 | "reqd": 1, 77 | "search_index": 0, 78 | "set_only_once": 0, 79 | "translatable": 0, 80 | "unique": 0 81 | }, 82 | { 83 | "allow_bulk_edit": 0, 84 | "allow_in_quick_entry": 0, 85 | "allow_on_submit": 0, 86 | "bold": 0, 87 | "collapsible": 0, 88 | "columns": 0, 89 | "fieldname": "no_of_people", 90 | "fieldtype": "Int", 91 | "hidden": 0, 92 | "ignore_user_permissions": 0, 93 | "ignore_xss_filter": 0, 94 | "in_filter": 0, 95 | "in_global_search": 0, 96 | "in_list_view": 1, 97 | "in_standard_filter": 0, 98 | "label": "No of People", 99 | "length": 0, 100 | "no_copy": 0, 101 | "permlevel": 0, 102 | "precision": "", 103 | "print_hide": 0, 104 | "print_hide_if_no_value": 0, 105 | "read_only": 0, 106 | "remember_last_selected_value": 0, 107 | "report_hide": 0, 108 | "reqd": 1, 109 | "search_index": 0, 110 | "set_only_once": 0, 111 | "translatable": 0, 112 | "unique": 0 113 | }, 114 | { 115 | "allow_bulk_edit": 0, 116 | "allow_in_quick_entry": 0, 117 | "allow_on_submit": 0, 118 | "bold": 0, 119 | "collapsible": 0, 120 | "columns": 0, 121 | "fieldname": "reservation_time", 122 | "fieldtype": "Datetime", 123 | "hidden": 0, 124 | "ignore_user_permissions": 0, 125 | "ignore_xss_filter": 0, 126 | "in_filter": 0, 127 | "in_global_search": 0, 128 | "in_list_view": 0, 129 | "in_standard_filter": 0, 130 | "label": "Reservation Time", 131 | "length": 0, 132 | "no_copy": 0, 133 | "options": "", 134 | "permlevel": 0, 135 | "precision": "", 136 | "print_hide": 0, 137 | "print_hide_if_no_value": 0, 138 | "read_only": 0, 139 | "remember_last_selected_value": 0, 140 | "report_hide": 0, 141 | "reqd": 1, 142 | "search_index": 0, 143 | "set_only_once": 0, 144 | "translatable": 0, 145 | "unique": 0 146 | }, 147 | { 148 | "allow_bulk_edit": 0, 149 | "allow_in_quick_entry": 0, 150 | "allow_on_submit": 0, 151 | "bold": 0, 152 | "collapsible": 0, 153 | "columns": 0, 154 | "fieldname": "reservation_end_time", 155 | "fieldtype": "Datetime", 156 | "hidden": 0, 157 | "ignore_user_permissions": 0, 158 | "ignore_xss_filter": 0, 159 | "in_filter": 0, 160 | "in_global_search": 0, 161 | "in_list_view": 0, 162 | "in_standard_filter": 0, 163 | "label": "Reservation End Time", 164 | "length": 0, 165 | "no_copy": 0, 166 | "permlevel": 0, 167 | "precision": "", 168 | "print_hide": 0, 169 | "print_hide_if_no_value": 0, 170 | "read_only": 0, 171 | "remember_last_selected_value": 0, 172 | "report_hide": 0, 173 | "reqd": 0, 174 | "search_index": 0, 175 | "set_only_once": 0, 176 | "translatable": 0, 177 | "unique": 0 178 | }, 179 | { 180 | "allow_bulk_edit": 0, 181 | "allow_in_quick_entry": 0, 182 | "allow_on_submit": 0, 183 | "bold": 0, 184 | "collapsible": 0, 185 | "columns": 0, 186 | "fieldname": "column_break_4", 187 | "fieldtype": "Column Break", 188 | "hidden": 0, 189 | "ignore_user_permissions": 0, 190 | "ignore_xss_filter": 0, 191 | "in_filter": 0, 192 | "in_global_search": 0, 193 | "in_list_view": 0, 194 | "in_standard_filter": 0, 195 | "length": 0, 196 | "no_copy": 0, 197 | "permlevel": 0, 198 | "precision": "", 199 | "print_hide": 0, 200 | "print_hide_if_no_value": 0, 201 | "read_only": 0, 202 | "remember_last_selected_value": 0, 203 | "report_hide": 0, 204 | "reqd": 0, 205 | "search_index": 0, 206 | "set_only_once": 0, 207 | "translatable": 0, 208 | "unique": 0 209 | }, 210 | { 211 | "allow_bulk_edit": 0, 212 | "allow_in_quick_entry": 0, 213 | "allow_on_submit": 0, 214 | "bold": 0, 215 | "collapsible": 0, 216 | "columns": 0, 217 | "fieldname": "customer", 218 | "fieldtype": "Link", 219 | "hidden": 0, 220 | "ignore_user_permissions": 0, 221 | "ignore_xss_filter": 0, 222 | "in_filter": 0, 223 | "in_global_search": 0, 224 | "in_list_view": 0, 225 | "in_standard_filter": 0, 226 | "label": "Customer", 227 | "length": 0, 228 | "no_copy": 0, 229 | "options": "Customer", 230 | "permlevel": 0, 231 | "precision": "", 232 | "print_hide": 0, 233 | "print_hide_if_no_value": 0, 234 | "read_only": 0, 235 | "remember_last_selected_value": 0, 236 | "report_hide": 0, 237 | "reqd": 0, 238 | "search_index": 0, 239 | "set_only_once": 0, 240 | "translatable": 0, 241 | "unique": 0 242 | }, 243 | { 244 | "allow_bulk_edit": 0, 245 | "allow_in_quick_entry": 0, 246 | "allow_on_submit": 0, 247 | "bold": 0, 248 | "collapsible": 0, 249 | "columns": 0, 250 | "fieldname": "customer_name", 251 | "fieldtype": "Data", 252 | "hidden": 0, 253 | "ignore_user_permissions": 0, 254 | "ignore_xss_filter": 0, 255 | "in_filter": 0, 256 | "in_global_search": 1, 257 | "in_list_view": 1, 258 | "in_standard_filter": 1, 259 | "label": "Customer Name", 260 | "length": 0, 261 | "no_copy": 0, 262 | "permlevel": 0, 263 | "precision": "", 264 | "print_hide": 0, 265 | "print_hide_if_no_value": 0, 266 | "read_only": 0, 267 | "remember_last_selected_value": 0, 268 | "report_hide": 0, 269 | "reqd": 1, 270 | "search_index": 0, 271 | "set_only_once": 0, 272 | "translatable": 0, 273 | "unique": 0 274 | }, 275 | { 276 | "allow_bulk_edit": 0, 277 | "allow_in_quick_entry": 0, 278 | "allow_on_submit": 0, 279 | "bold": 0, 280 | "collapsible": 0, 281 | "columns": 0, 282 | "fieldname": "contact_number", 283 | "fieldtype": "Data", 284 | "hidden": 0, 285 | "ignore_user_permissions": 0, 286 | "ignore_xss_filter": 0, 287 | "in_filter": 0, 288 | "in_global_search": 0, 289 | "in_list_view": 1, 290 | "in_standard_filter": 0, 291 | "label": "Contact Number", 292 | "length": 0, 293 | "no_copy": 0, 294 | "permlevel": 0, 295 | "precision": "", 296 | "print_hide": 0, 297 | "print_hide_if_no_value": 0, 298 | "read_only": 0, 299 | "remember_last_selected_value": 0, 300 | "report_hide": 0, 301 | "reqd": 0, 302 | "search_index": 0, 303 | "set_only_once": 0, 304 | "translatable": 0, 305 | "unique": 0 306 | } 307 | ], 308 | "has_web_view": 0, 309 | "hide_heading": 0, 310 | "hide_toolbar": 0, 311 | "idx": 0, 312 | "image_view": 0, 313 | "in_create": 0, 314 | "is_submittable": 0, 315 | "issingle": 0, 316 | "istable": 0, 317 | "max_attachments": 0, 318 | "modified": "2018-08-21 16:15:38.435656", 319 | "modified_by": "Administrator", 320 | "module": "Restaurant", 321 | "name": "Restaurant Reservation", 322 | "name_case": "", 323 | "owner": "Administrator", 324 | "permissions": [ 325 | { 326 | "amend": 0, 327 | "cancel": 0, 328 | "create": 1, 329 | "delete": 1, 330 | "email": 1, 331 | "export": 1, 332 | "if_owner": 0, 333 | "import": 0, 334 | "permlevel": 0, 335 | "print": 1, 336 | "read": 1, 337 | "report": 1, 338 | "role": "Restaurant Manager", 339 | "set_user_permissions": 0, 340 | "share": 1, 341 | "submit": 0, 342 | "write": 1 343 | } 344 | ], 345 | "quick_entry": 1, 346 | "read_only": 0, 347 | "read_only_onload": 0, 348 | "restrict_to_domain": "Hospitality", 349 | "show_name_in_global_search": 0, 350 | "sort_field": "modified", 351 | "sort_order": "DESC", 352 | "track_changes": 1, 353 | "track_seen": 0, 354 | "track_views": 0 355 | } -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_reservation/restaurant_reservation.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | from datetime import timedelta 6 | 7 | from frappe.model.document import Document 8 | from frappe.utils import get_datetime 9 | 10 | 11 | class RestaurantReservation(Document): 12 | def validate(self): 13 | if not self.reservation_end_time: 14 | self.reservation_end_time = get_datetime(self.reservation_time) + timedelta(hours=1) 15 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_reservation/restaurant_reservation_calendar.js: -------------------------------------------------------------------------------- 1 | frappe.views.calendar["Restaurant Reservation"] = { 2 | field_map: { 3 | "start": "reservation_time", 4 | "end": "reservation_end_time", 5 | "id": "name", 6 | "title": "customer_name", 7 | "allDay": "allDay", 8 | }, 9 | gantt: true, 10 | filters: [ 11 | { 12 | "fieldtype": "Data", 13 | "fieldname": "customer_name", 14 | "label": __("Customer Name") 15 | } 16 | ], 17 | get_events_method: "frappe.desk.calendar.get_events" 18 | }; 19 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_reservation/test_restaurant_reservation.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | 7 | class TestRestaurantReservation(unittest.TestCase): 8 | pass 9 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_table/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/restaurant/doctype/restaurant_table/__init__.py -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_table/restaurant_table.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Restaurant Table', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_table/restaurant_table.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_guest_to_view": 0, 4 | "allow_import": 0, 5 | "allow_rename": 0, 6 | "autoname": "", 7 | "beta": 1, 8 | "creation": "2017-09-15 12:45:24.717355", 9 | "custom": 0, 10 | "docstatus": 0, 11 | "doctype": "DocType", 12 | "document_type": "Setup", 13 | "editable_grid": 1, 14 | "engine": "InnoDB", 15 | "fields": [ 16 | { 17 | "allow_bulk_edit": 0, 18 | "allow_on_submit": 0, 19 | "bold": 0, 20 | "collapsible": 0, 21 | "columns": 0, 22 | "fieldname": "restaurant", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "ignore_user_permissions": 0, 26 | "ignore_xss_filter": 0, 27 | "in_filter": 0, 28 | "in_global_search": 0, 29 | "in_list_view": 0, 30 | "in_standard_filter": 0, 31 | "label": "Restaurant", 32 | "length": 0, 33 | "no_copy": 0, 34 | "options": "Restaurant", 35 | "permlevel": 0, 36 | "precision": "", 37 | "print_hide": 0, 38 | "print_hide_if_no_value": 0, 39 | "read_only": 0, 40 | "remember_last_selected_value": 0, 41 | "report_hide": 0, 42 | "reqd": 1, 43 | "search_index": 0, 44 | "set_only_once": 0, 45 | "unique": 0 46 | }, 47 | { 48 | "allow_bulk_edit": 0, 49 | "allow_on_submit": 0, 50 | "bold": 0, 51 | "collapsible": 0, 52 | "columns": 0, 53 | "fieldname": "no_of_seats", 54 | "fieldtype": "Int", 55 | "hidden": 0, 56 | "ignore_user_permissions": 0, 57 | "ignore_xss_filter": 0, 58 | "in_filter": 0, 59 | "in_global_search": 0, 60 | "in_list_view": 1, 61 | "in_standard_filter": 0, 62 | "label": "No of Seats", 63 | "length": 0, 64 | "no_copy": 0, 65 | "permlevel": 0, 66 | "precision": "", 67 | "print_hide": 0, 68 | "print_hide_if_no_value": 0, 69 | "read_only": 0, 70 | "remember_last_selected_value": 0, 71 | "report_hide": 0, 72 | "reqd": 1, 73 | "search_index": 0, 74 | "set_only_once": 0, 75 | "unique": 0 76 | }, 77 | { 78 | "allow_bulk_edit": 0, 79 | "allow_on_submit": 0, 80 | "bold": 0, 81 | "collapsible": 0, 82 | "columns": 0, 83 | "default": "1", 84 | "fieldname": "minimum_seating", 85 | "fieldtype": "Int", 86 | "hidden": 0, 87 | "ignore_user_permissions": 0, 88 | "ignore_xss_filter": 0, 89 | "in_filter": 0, 90 | "in_global_search": 0, 91 | "in_list_view": 1, 92 | "in_standard_filter": 0, 93 | "label": "Minimum Seating", 94 | "length": 0, 95 | "no_copy": 0, 96 | "permlevel": 0, 97 | "precision": "", 98 | "print_hide": 0, 99 | "print_hide_if_no_value": 0, 100 | "read_only": 0, 101 | "remember_last_selected_value": 0, 102 | "report_hide": 0, 103 | "reqd": 1, 104 | "search_index": 0, 105 | "set_only_once": 0, 106 | "unique": 0 107 | } 108 | ], 109 | "has_web_view": 0, 110 | "hide_heading": 0, 111 | "hide_toolbar": 0, 112 | "idx": 0, 113 | "image_view": 0, 114 | "in_create": 0, 115 | "is_submittable": 0, 116 | "issingle": 0, 117 | "istable": 0, 118 | "max_attachments": 0, 119 | "modified": "2017-12-09 12:13:24.382345", 120 | "modified_by": "Administrator", 121 | "module": "Restaurant", 122 | "name": "Restaurant Table", 123 | "name_case": "", 124 | "owner": "Administrator", 125 | "permissions": [ 126 | { 127 | "amend": 0, 128 | "apply_user_permissions": 0, 129 | "cancel": 0, 130 | "create": 1, 131 | "delete": 1, 132 | "email": 1, 133 | "export": 1, 134 | "if_owner": 0, 135 | "import": 0, 136 | "permlevel": 0, 137 | "print": 1, 138 | "read": 1, 139 | "report": 1, 140 | "role": "Restaurant Manager", 141 | "set_user_permissions": 0, 142 | "share": 1, 143 | "submit": 0, 144 | "write": 1 145 | } 146 | ], 147 | "quick_entry": 1, 148 | "read_only": 0, 149 | "read_only_onload": 0, 150 | "restrict_to_domain": "Hospitality", 151 | "show_name_in_global_search": 0, 152 | "sort_field": "modified", 153 | "sort_order": "DESC", 154 | "track_changes": 1, 155 | "track_seen": 0 156 | } -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_table/restaurant_table.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors 2 | # For license information, please see license.txt 3 | 4 | 5 | import re 6 | 7 | from frappe.model.document import Document 8 | from frappe.model.naming import make_autoname 9 | 10 | 11 | class RestaurantTable(Document): 12 | def autoname(self): 13 | prefix = re.sub('-+', '-', self.restaurant.replace(' ', '-')) 14 | self.name = make_autoname(prefix + '-.##') 15 | -------------------------------------------------------------------------------- /hospitality/restaurant/doctype/restaurant_table/test_restaurant_table.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | import unittest 5 | 6 | test_records = [ 7 | dict(restaurant='Test Restaurant 1', no_of_seats=5, minimum_seating=1), 8 | dict(restaurant='Test Restaurant 1', no_of_seats=5, minimum_seating=1), 9 | dict(restaurant='Test Restaurant 1', no_of_seats=5, minimum_seating=1), 10 | dict(restaurant='Test Restaurant 1', no_of_seats=5, minimum_seating=1), 11 | ] 12 | 13 | class TestRestaurantTable(unittest.TestCase): 14 | pass 15 | -------------------------------------------------------------------------------- /hospitality/templates/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/templates/__init__.py -------------------------------------------------------------------------------- /hospitality/templates/pages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/hospitality/2003ff8db7d7fbc453a9d14da0f971b9186a0b4b/hospitality/templates/pages/__init__.py -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # frappe -- https://github.com/frappe/frappe is installed via 'bench init' -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | with open("requirements.txt") as f: 4 | install_requires = f.read().strip().split("\n") 5 | 6 | # get version from __version__ variable in hospitality/__init__.py 7 | from hospitality import __version__ as version 8 | 9 | setup( 10 | name="hospitality", 11 | version=version, 12 | description="Hospitality", 13 | author="Frappe", 14 | author_email="pandikunta@frappe.io", 15 | packages=find_packages(), 16 | zip_safe=False, 17 | include_package_data=True, 18 | install_requires=install_requires 19 | ) 20 | --------------------------------------------------------------------------------