diff --git a/pms/views/pms_room_views.xml b/pms/views/pms_room_views.xml index 9d3d47e37..0ffc2851b 100644 --- a/pms/views/pms_room_views.xml +++ b/pms/views/pms_room_views.xml @@ -3,6 +3,7 @@ pms.room.form pms.room +
diff --git a/pms_housekeeping/README.rst b/pms_housekeeping/README.rst new file mode 100644 index 000000000..15640e22b --- /dev/null +++ b/pms_housekeeping/README.rst @@ -0,0 +1,78 @@ +============ +Housekeeping +============ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpms-lightgray.png?logo=github + :target: https://github.com/OCA/pms/tree/14.0/pms_housekeeping + :alt: OCA/pms +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pms-14-0/pms-14-0-pms_housekeeping + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/293/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is an all-in-one property management system (PMS) focused on medium-sized hotels +for managing every aspect of your property's daily operations. + +You can manage hotel properties with multi-hotel and multi-company support, including your rooms inventory, +reservations, check-in, daily reports, board services, rate and availability plans among other hotel functionalities. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Jose Luis Algara + +Contributors +~~~~~~~~~~~~ + +* Jose Luis Algara +* Darío Lodeiros + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/pms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pms_housekeeping/__init__.py b/pms_housekeeping/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/pms_housekeeping/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pms_housekeeping/__manifest__.py b/pms_housekeeping/__manifest__.py new file mode 100644 index 000000000..ca3528f27 --- /dev/null +++ b/pms_housekeeping/__manifest__.py @@ -0,0 +1,29 @@ +# Copyright 2020-21 Jose Luis Algara (Alda Hotels ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Housekeeping", + "version": "14.0.1.0.1", + "author": "Jose Luis Algara, " "Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": True, + "category": "pms", + "website": "https://github.com/OCA/pms", + "depends": [ + "pms", + "hr", + ], + "data": [ + # "wizard/housekeeping_rack.xml", + "views/pms_room_view.xml", + "views/pms_reservation_view.xml", + "views/pms_housekeeping_task_view.xml", + "views/pms_housekeeping_views.xml", + "security/ir.model.access.csv", + "data/cron_jobs.xml", + ], + "demo": [ + "demo/pms_housekeeping.xml", + ], + "installable": True, +} diff --git a/pms_housekeeping/data/cron_jobs.xml b/pms_housekeeping/data/cron_jobs.xml new file mode 100644 index 000000000..dcab72383 --- /dev/null +++ b/pms_housekeeping/data/cron_jobs.xml @@ -0,0 +1,21 @@ + + + + + + Automatic add all today housekeeping tasks + 1 + + days + -1 + + code + + + model.add_all_today_tasks() + + + diff --git a/pms_housekeeping/demo/pms_housekeeping.xml b/pms_housekeeping/demo/pms_housekeeping.xml new file mode 100644 index 000000000..e94183ba3 --- /dev/null +++ b/pms_housekeeping/demo/pms_housekeeping.xml @@ -0,0 +1,65 @@ + + + + + + Full clean + exit + + + Soft clean + occupied + + + Review + + + Inspect + + exit + + + Inspect + + occupied + + + + + + + to_do + + + + + + to_do + + + + + + draft + + + + + + draft + + + Need clean it again + + + + to_do + + + + + + draft + + + diff --git a/pms_housekeeping/models/__init__.py b/pms_housekeeping/models/__init__.py new file mode 100644 index 000000000..4ec8da670 --- /dev/null +++ b/pms_housekeeping/models/__init__.py @@ -0,0 +1,7 @@ +# Copyright 2021 Jose Luis Algara +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import pms_housekeeping_task +from . import pms_housekeeping +from . import pms_reservation +from . import pms_room diff --git a/pms_housekeeping/models/pms_housekeeping.py b/pms_housekeeping/models/pms_housekeeping.py new file mode 100644 index 000000000..f97a935d9 --- /dev/null +++ b/pms_housekeeping/models/pms_housekeeping.py @@ -0,0 +1,42 @@ +# Copyright 2020 Jose Luis Algara (Alda Hotels ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class HouseKeeping(models.Model): + _name = "pms.housekeeping" + _description = "HouseKeeping" + # HouseKeeping 'log' + + # Fields declaration + + task_date = fields.Date( + string="Clean date", default=lambda self: fields.Datetime.now(), required=True + ) + task_start = fields.Datetime(string="Task start at") + task_end = fields.Datetime(string="Task end at") + room_id = fields.Many2one("pms.room", string="Room") + employee_id = fields.Many2one("hr.employee", string="Employee") + task_id = fields.Many2one("pms.housekeeping.task", string="Task", required=True) + notes = fields.Text("Internal Notes") + lostfound = fields.Text("Lost and Found") + state = fields.Selection( + string="Task State", + selection=[ + ("draft", "Draft"), + ("to_do", "To Do"), + ("in_progress", "In Progress"), + ("done", "Done"), + ], + default="draft", + ) + color = fields.Integer("Color Index") + + # Default Methods ang Gets + def name_get(self): + result = [] + for task in self: + name = task.task_id.name + result.append((task.id, name)) + return result diff --git a/pms_housekeeping/models/pms_housekeeping_task.py b/pms_housekeeping/models/pms_housekeeping_task.py new file mode 100644 index 000000000..86c180cc2 --- /dev/null +++ b/pms_housekeeping/models/pms_housekeeping_task.py @@ -0,0 +1,32 @@ +# Copyright 2020 Jose Luis Algara (Alda Hotels ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class HouseKeepingTask(models.Model): + _name = "pms.housekeeping.task" + _description = "HouseKeeping Tasks" + # HouseKeeping 'Task types' + + # Fields declaration + active = fields.Boolean("Active", default=True) + name = fields.Char("Task Name", translate=True, required=True) + pms_property_ids = fields.Many2many( + "pms.property", string="Properties", required=False, ondelete="restrict" + ) + clean_type = fields.Selection( + string="Clean type", + selection=[ + ("occupied", "Occupied"), + ("exit", "Exit"), + ("picked_up", "Picked up"), + ("staff", "Staff"), + ("clean", "Clean"), + ("inspected", "Inspected"), + ("dont_disturb", "Don't disturb"), + ], + ) + def_employee_id = fields.Many2one( + "hr.employee", string="Employee assigned by default" + ) diff --git a/pms_housekeeping/models/pms_reservation.py b/pms_housekeeping/models/pms_reservation.py new file mode 100644 index 000000000..10cd05469 --- /dev/null +++ b/pms_housekeeping/models/pms_reservation.py @@ -0,0 +1,13 @@ +# Copyright 2021 Jose Luis Algara (Alda Hotels ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class PmsRoom(models.Model): + _inherit = "pms.reservation" + + dont_disturb = fields.Boolean( + string="Dont disturb", + default=False, + ) diff --git a/pms_housekeeping/models/pms_room.py b/pms_housekeeping/models/pms_room.py new file mode 100644 index 000000000..17a31b69d --- /dev/null +++ b/pms_housekeeping/models/pms_room.py @@ -0,0 +1,140 @@ +# Copyright 2021 Jose Luis Algara (Alda Hotels ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging +from datetime import datetime, timedelta + +from odoo import fields, models + +_logger = logging.getLogger(__name__) + + +def kanban_card_color(state): + colors = { + "occupied": 2, + "exit": 3, + "picked_up": 7, + "staff": 11, + "clean": 4, + "inspected": 10, + "dont_disturb": 9, + } + return colors[state] + + +class PmsRoom(models.Model): + _inherit = "pms.room" + + housekeeping_ids = fields.One2many( + string="Housekeeping tasks", + comodel_name="pms.housekeeping", + inverse_name="room_id", + domain=[("task_date", "=", datetime.now().date())], + ) + + clean_status = fields.Selection( + string="Clean type", + selection=[ + ("occupied", "Occupied"), + ("exit", "Exit"), + ("picked_up", "Picked up"), + ("staff", "Staff"), + ("clean", "Clean"), + ("inspected", "Inspected"), + ("dont_disturb", "Don't disturb"), + ], + compute="_compute_clean_status", + # store=True, + ) + + clean_employee_id = fields.Many2one( + "hr.employee", + string="Default employee", + help="Cleaning employee assigned by default", + ) + employee_picture = fields.Binary( + string="Employee picture", related="clean_employee_id.image_1920" + ) + + # @api.depends('clean_status_now') + def _compute_clean_status(self): + for room in self: + room.clean_status = room.get_clean_status() + return + + # Business methods + def get_clean_status(self, date_clean=False, margin_days=5): + status = "NONE" + if not date_clean: + date_clean = fields.Date.today() + reservations = self.env["pms.reservation.line"].search( + [ + ("room_id", "=", self.id), + ("date", "<=", date_clean + timedelta(days=margin_days)), + ("date", ">=", date_clean - timedelta(days=margin_days)), + ] + ) + today_res = reservations.filtered( + lambda reservation: reservation.date == date_clean + ) + yesterday_res = reservations.filtered( + lambda reservation: reservation.date == date_clean - (timedelta(days=1)) + ) + lasts_res = reservations.filtered( + lambda reservation: reservation.date < date_clean + ) + + if today_res.reservation_id.reservation_type == "out": + status = "dont_disturb" + return status + if len(today_res) == 0: + if len(yesterday_res) != 0: + status = "exit" + elif len(lasts_res) != 0: + status = "clean" + else: + # TODO hace cuantos dias se limpio o repaso.?? + status = "picked_up" + return status + else: + if yesterday_res.reservation_id != today_res.reservation_id: + status = "exit" + else: + if today_res.reservation_id.reservation_type == "staff": + status = "staff" + elif today_res.reservation_id.dont_disturb: + status = "dont_disturb" + else: + status = "occupied" + # TODO hace cuantos dias que la ocupa.?? + return status + + def add_today_tasks(self): + for room in self: + tasks = self.env["pms.housekeeping.task"].search( + [("clean_type", "=", room.clean_status)] + ) + for task in tasks: + new_task = self.env["pms.housekeeping"] + employee = ( + task.def_employee_id.id + if len(task.def_employee_id) > 0 + else room.clean_employee_id.id + ) + new_task.create( + { + "room_id": room.id, + "employee_id": employee, + "task_id": task.id, + "state": "draft", + "color": kanban_card_color(room.clean_status), + } + ) + return + + def add_all_today_tasks(self): + rooms = self.env["pms.room"].search([]) + _logger.warning("Init Add All today Task") + for room in rooms: + room.add_today_tasks() + return diff --git a/pms_housekeeping/readme/CONTRIBUTORS.rst b/pms_housekeeping/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..73917ee23 --- /dev/null +++ b/pms_housekeeping/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Jose Luis Algara +* Darío Lodeiros diff --git a/pms_housekeeping/readme/DESCRIPTION.rst b/pms_housekeeping/readme/DESCRIPTION.rst new file mode 100644 index 000000000..182da89bd --- /dev/null +++ b/pms_housekeeping/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module is an all-in-one property management system (PMS) focused on medium-sized hotels +for managing every aspect of your property's daily operations. + +You can manage hotel properties with multi-hotel and multi-company support, including your rooms inventory, +reservations, check-in, daily reports, board services, rate and availability plans among other hotel functionalities. diff --git a/pms_housekeeping/security/ir.model.access.csv b/pms_housekeeping/security/ir.model.access.csv new file mode 100644 index 000000000..5c5e86eae --- /dev/null +++ b/pms_housekeeping/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +user_access_pms_housekeeping,user_access_pms_housekeeping,model_pms_housekeeping,pms.group_pms_user,1,1,1,1 +user_access_pms_housekeeping_task,user_access_pms_housekeeping_task,model_pms_housekeeping_task,pms.group_pms_user,1,1,1,1 diff --git a/pms_housekeeping/static/description/icon.png b/pms_housekeeping/static/description/icon.png new file mode 100644 index 000000000..946adacbe Binary files /dev/null and b/pms_housekeeping/static/description/icon.png differ diff --git a/pms_housekeeping/static/description/index.html b/pms_housekeeping/static/description/index.html new file mode 100644 index 000000000..27d8da212 --- /dev/null +++ b/pms_housekeeping/static/description/index.html @@ -0,0 +1,423 @@ + + + + + + +Housekeeping + + + +
+

Housekeeping

+ + +

Beta License: AGPL-3 OCA/pms Translate me on Weblate Try me on Runbot

+

This module is an all-in-one property management system (PMS) focused on medium-sized hotels +for managing every aspect of your property’s daily operations.

+

You can manage hotel properties with multi-hotel and multi-company support, including your rooms inventory, +reservations, check-in, daily reports, board services, rate and availability plans among other hotel functionalities.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Jose Luis Algara
  • +
+
+
+

Contributors

+
    +
  • Jose Luis Algara
  • +
  • Darío Lodeiros
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/pms project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/pms_housekeeping/views/pms_housekeeping_task_view.xml b/pms_housekeeping/views/pms_housekeeping_task_view.xml new file mode 100644 index 000000000..7b1c963f0 --- /dev/null +++ b/pms_housekeeping/views/pms_housekeeping_task_view.xml @@ -0,0 +1,34 @@ + + + + + Housekeeping Tasks view + pms.housekeeping.task + tree + primary + + + + + + + + + + + + + Housekeeping Tasks + pms.housekeeping.task + tree,form + + + + + diff --git a/pms_housekeeping/views/pms_housekeeping_views.xml b/pms_housekeeping/views/pms_housekeeping_views.xml new file mode 100644 index 000000000..03b50692a --- /dev/null +++ b/pms_housekeeping/views/pms_housekeeping_views.xml @@ -0,0 +1,257 @@ + + + + Housekeeping tree view + pms.housekeeping + tree + primary + + + + + + + + + + + + + + + + + + + Housekeeping form view + pms.housekeeping + form + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Housekeeping today tasks kanban view + pms.housekeeping + kanban + primary + + + + + + + + + + + +
+ +
+ + +
+ +
+
+ +
+ +
+ + + Employee image + +
+
+ + + +
+
+
+
+ + + + + + + + pms.housekeeping + + + + + + + + + + + + + + + + + + + + + + + + + + + Housekeeping + pms.housekeeping + tree,form + + + + Housekeeping + pms.housekeeping + [('task_date', '=',(context_today().strftime('%Y-%m-%d')))] + + kanban,tree,form + + + + + + + + diff --git a/pms_housekeeping/views/pms_reservation_view.xml b/pms_housekeeping/views/pms_reservation_view.xml new file mode 100644 index 000000000..79131a42d --- /dev/null +++ b/pms_housekeeping/views/pms_reservation_view.xml @@ -0,0 +1,15 @@ + + + + + view.model.form + pms.reservation + + + + + + + + + diff --git a/pms_housekeeping/views/pms_room_view.xml b/pms_housekeeping/views/pms_room_view.xml new file mode 100644 index 000000000..68d64fa82 --- /dev/null +++ b/pms_housekeeping/views/pms_room_view.xml @@ -0,0 +1,212 @@ + + + + + view.model.form + pms.room + + + + + + + + + + + + + Room rack form view + pms.room + form + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + Room rack tree view + pms.room + tree + + + + + + + + + + + + + + + pms.room + + + + + + + + + + + + + + + + + + + Room rack kanban view + pms.room + kanban + primary + + + + + + + +
+ +
+ +
+ + +
+ +
+ +
+ + + +
+
+
+
+ + + + + + + Housekeeping + pms.room + kanban,tree,form + + + + diff --git a/setup/pms_housekeeping/odoo/addons/pms_housekeeping b/setup/pms_housekeeping/odoo/addons/pms_housekeeping new file mode 120000 index 000000000..b9627f033 --- /dev/null +++ b/setup/pms_housekeeping/odoo/addons/pms_housekeeping @@ -0,0 +1 @@ +../../../../pms_housekeeping \ No newline at end of file diff --git a/setup/pms_housekeeping/setup.py b/setup/pms_housekeeping/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/pms_housekeeping/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)