diff --git a/pms_housekeeping/__manifest__.py b/pms_housekeeping/__manifest__.py
index 79e2fc513..92c7d9212 100644
--- a/pms_housekeeping/__manifest__.py
+++ b/pms_housekeeping/__manifest__.py
@@ -21,6 +21,7 @@
"views/pms_housekeeping_task_type_views.xml",
"views/pms_housekeeping_views.xml",
"views/pms_housekeeping_task_views.xml",
+ "views/pms_room_views.xml",
],
"installable": True,
}
diff --git a/pms_housekeeping/data/pms_housekeeping_data.xml b/pms_housekeeping/data/pms_housekeeping_data.xml
index 9e7782898..6498ae832 100644
--- a/pms_housekeeping/data/pms_housekeeping_data.xml
+++ b/pms_housekeeping/data/pms_housekeeping_data.xml
@@ -3,4 +3,10 @@
Housekeeper
open
+
+ Don“t disturb
+
+
+ Promotion
+
diff --git a/pms_housekeeping/models/__init__.py b/pms_housekeeping/models/__init__.py
index 52a172889..7843ee7c0 100644
--- a/pms_housekeeping/models/__init__.py
+++ b/pms_housekeeping/models/__init__.py
@@ -4,3 +4,5 @@
from . import hr_employee
from . import pms_housekeeping_task_type
from . import pms_housekeeping_task
+from . import pms_housekeeping_cancellation_type
+from . import pms_room
diff --git a/pms_housekeeping/models/pms_housekeeping_cancellation_type.py b/pms_housekeeping/models/pms_housekeeping_cancellation_type.py
new file mode 100644
index 000000000..3111706ab
--- /dev/null
+++ b/pms_housekeeping/models/pms_housekeeping_cancellation_type.py
@@ -0,0 +1,8 @@
+from odoo import fields, models, api
+
+
+class PmsHousekeepingCancellationType(models.Model):
+ _name = 'pms.housekeeping.cancellation.type'
+
+ name = fields.Char(string="Name", required=True)
+ description = fields.Text(string="Description")
diff --git a/pms_housekeeping/models/pms_housekeeping_task.py b/pms_housekeeping/models/pms_housekeeping_task.py
index b0170642f..7a6e2de33 100644
--- a/pms_housekeeping/models/pms_housekeeping_task.py
+++ b/pms_housekeeping/models/pms_housekeeping_task.py
@@ -1,4 +1,5 @@
-from odoo import fields, models
+from odoo import fields, models, api
+from odoo.exceptions import ValidationError
class PmsHouseKeepingTask(models.Model):
@@ -17,10 +18,10 @@ class PmsHouseKeepingTask(models.Model):
required=True,
ondelete="restrict",
)
- task_datetime = fields.Datetime(string="Date")
+ task_date = fields.Date(string="Date", required=True,)
state = fields.Selection(
selection=[
- ("holding", "On Holding"),
+ ("pending", "Pending"),
("to_do", "To Do"),
("in_progress", "In Progress"),
("done", "Done"),
@@ -44,5 +45,70 @@ class PmsHouseKeepingTask(models.Model):
string="Parent Task",
help="Indicates that this task is a child of another task",
comodel_name="pms.housekeeping.task",
+ domain="[('id', '!=', id)]",
+ )
+ parent_state = fields.Char(
+ string="Parent State",
+ compute="_compute_parent_state",
+ )
+ cancellation_type_id = fields.Many2one(
+ comodel_name="pms.housekeeping.cancellation.type",
+ string="Cancellation Type",
ondelete="restrict",
)
+ is_today = fields.Boolean(
+ string="Is Today",
+ compute="_compute_is_today",
+ store=True,
+ readonly=False,
+ )
+ is_future = fields.Boolean(
+ string="Is Future",
+ compute="_compute_is_future",
+ )
+
+ @api.constrains("task_date")
+ def _check_task_date(self):
+ for rec in self:
+ if rec.task_date < fields.Date.today():
+ raise ValidationError("Task Date must be greater than or equal to today")
+
+ def action_cancel(self):
+ for rec in self:
+ rec.state = "cancel"
+
+ def action_to_do(self):
+ for rec in self:
+ rec.state = "to_do"
+
+ def action_done(self):
+ for rec in self:
+ rec.state = "done"
+
+ def action_in_progress(self):
+ for rec in self:
+ rec.state = "in_progress"
+
+ def action_pending(self):
+ for rec in self:
+ rec.state = "pending"
+
+ @api.depends("parent_id.state")
+ def _compute_parent_state(self):
+ for rec in self:
+ rec.parent_state = rec.parent_id.state if rec.parent_id else False
+
+ @api.depends("task_date")
+ def _compute_is_today(self):
+ for rec in self:
+ if rec.task_date:
+ rec.is_today = rec.task_date == fields.Date.today()
+ else:
+ rec.is_today = False
+ @api.depends("task_date")
+ def _compute_is_future(self):
+ for rec in self:
+ if rec.task_date:
+ rec.is_future = rec.task_date > fields.Date.today()
+ else:
+ rec.is_future = False
diff --git a/pms_housekeeping/models/pms_housekeeping_task_type.py b/pms_housekeeping/models/pms_housekeeping_task_type.py
index 05b283219..0bb25f22d 100644
--- a/pms_housekeeping/models/pms_housekeeping_task_type.py
+++ b/pms_housekeeping/models/pms_housekeeping_task_type.py
@@ -12,8 +12,8 @@ class PmsHouseKeepingTaskType(models.Model):
is_checkin = fields.Boolean(string="Checkin")
is_checkout = fields.Boolean(string="Checkout")
priority = fields.Integer(string="Priority", default=0)
- days_after_clean_overnight = fields.Integer(string="Days After Clean",)
- days_after_clean_empty = fields.Integer(string="Days After Clean", )
+ days_after_clean_overnight = fields.Integer(string="Days After Clean Overnight",)
+ days_after_clean_empty = fields.Integer(string="Days After Clean Empty", )
housekeepers = fields.Many2many(
comodel_name="hr.employee",
relation="pms_housekeeping_task_type_hr_employee_rel",
@@ -22,13 +22,10 @@ class PmsHouseKeepingTaskType(models.Model):
string="Housekeepers",
domain="[('job_id.name', '=', 'Housekeeper')]",
)
- parent_id = fields.Many2many(
+ parent_id = fields.Many2one(
string="Parent Task Type",
help="Indicates that this task type is a child of another task type",
comodel_name="pms.housekeeping.task.type",
- relation="pms_housekeeping_task_type_rel",
- column1="parent_task_type_id",
- column2="child_task_type_id",
- ondelete="restrict",
domain="[('id', '!=', id)]",
)
+ is_inspection = fields.Boolean(string="Inspection")
diff --git a/pms_housekeeping/models/pms_room.py b/pms_housekeeping/models/pms_room.py
new file mode 100644
index 000000000..ea0fc069e
--- /dev/null
+++ b/pms_housekeeping/models/pms_room.py
@@ -0,0 +1,17 @@
+from odoo import fields, models, api
+
+
+class PmsRoom(models.Model):
+ _inherit = "pms.room"
+
+ housekeeping_state = fields.Selection(
+ selection=[
+ ("dirty", "Dirty"),
+ ("to_inspect", "To Inspect"),
+ ("clean", "Clean"),
+ ],
+ string="Housekeeping State",
+ required=True,
+ default="dirty",
+ )
+
diff --git a/pms_housekeeping/security/ir.model.access.csv b/pms_housekeeping/security/ir.model.access.csv
index bd1fd1356..f17dcb454 100644
--- a/pms_housekeeping/security/ir.model.access.csv
+++ b/pms_housekeeping/security/ir.model.access.csv
@@ -1,3 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
user_access_pms_housekeeping_task_type,user_access_pms_housekeeping_task_type,model_pms_housekeeping_task_type,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
+user_access_pms_housekeeping_cancellation_type,user_access_pms_housekeeping_cancellation_type,model_pms_housekeeping_cancellation_type,pms.group_pms_user,1,1,1,1
diff --git a/pms_housekeeping/views/pms_housekeeping_task_type_views.xml b/pms_housekeeping/views/pms_housekeeping_task_type_views.xml
index 42b5e813a..d74857f0f 100644
--- a/pms_housekeeping/views/pms_housekeeping_task_type_views.xml
+++ b/pms_housekeeping/views/pms_housekeeping_task_type_views.xml
@@ -8,8 +8,9 @@
+
-
+
@@ -28,18 +29,26 @@
diff --git a/pms_housekeeping/views/pms_housekeeping_task_views.xml b/pms_housekeeping/views/pms_housekeeping_task_views.xml
index 6d4a7b396..e95a65abc 100644
--- a/pms_housekeeping/views/pms_housekeeping_task_views.xml
+++ b/pms_housekeeping/views/pms_housekeeping_task_views.xml
@@ -24,22 +24,63 @@
diff --git a/pms_housekeeping/views/pms_room_views.xml b/pms_housekeeping/views/pms_room_views.xml
new file mode 100644
index 000000000..93797043b
--- /dev/null
+++ b/pms_housekeeping/views/pms_room_views.xml
@@ -0,0 +1,13 @@
+
+
+
+ pms.room
+
+
+
+
+
+
+
+
+