Skip to content

Commit

Permalink
[WIP]14.0-pms_new_housekeeping: working in housekeeping tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
braisab committed Feb 8, 2024
1 parent d2d5414 commit 16d1ed3
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 28 deletions.
1 change: 1 addition & 0 deletions pms_housekeeping/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"views/hr_employee_views.xml",
"views/pms_housekeeping_task_type_views.xml",
"views/pms_housekeeping_views.xml",
"views/pms_housekeeping_task_views.xml",
],
"installable": True,
}
1 change: 1 addition & 0 deletions pms_housekeeping/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

from . import hr_employee
from . import pms_housekeeping_task_type
from . import pms_housekeeping_task
48 changes: 48 additions & 0 deletions pms_housekeeping/models/pms_housekeeping_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from odoo import fields, models


class PmsHouseKeepingTask(models.Model):
_name = "pms.housekeeping.task"

name = fields.Char(string="Name", required=True)
room_id = fields.Many2one(
comodel_name="pms.room",
string="Room",
required=True,
ondelete="restrict",
)
task_type_id = fields.Many2one(
comodel_name="pms.housekeeping.task.type",
string="Task Type",
required=True,
ondelete="restrict",
)
task_datetime = fields.Datetime(string="Date")
state = fields.Selection(
selection=[
("holding", "On Holding"),
("to_do", "To Do"),
("in_progress", "In Progress"),
("done", "Done"),
("cancel", "Cancel"),
],
string="State",
required=True,
default="to_do",
)
priority = fields.Integer(string="Priority", default=0)
cleaning_comments = fields.Text(string="Cleaning Comments")
employee_ids = fields.Many2many(
comodel_name="hr.employee",
relation="pms_housekeeping_task_hr_employee_rel",
column1="task_id",
column2="employee_id",
string="Employees",
domain="[('job_id.name', '=', 'Housekeeper')]",
)
parent_id = fields.Many2one(
string="Parent Task",
help="Indicates that this task is a child of another task",
comodel_name="pms.housekeeping.task",
ondelete="restrict",
)
20 changes: 7 additions & 13 deletions pms_housekeeping/models/pms_housekeeping_task_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@ class PmsHouseKeepingTaskType(models.Model):
name = fields.Char(string="Name", required=True)
description = fields.Text(string="Description")
is_automated = fields.Boolean(string="Is Automated")
clean_event = fields.Selection(
selection=[
("overnight", "Overnight"),
("checkin", "Checkin"),
("checkout", "Checkout"),
("empty", "Empty"),
("priority", "Priority"),
],
string="Clean When",
required=True,
default="overnight",
)
days_after_clean_event = fields.Integer(string="Days After Clean Event")
is_overnight = fields.Boolean(string="Overnight")
is_empty = fields.Boolean(string="Empty")
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", )
housekeepers = fields.Many2many(
comodel_name="hr.employee",
relation="pms_housekeeping_task_type_hr_employee_rel",
Expand Down
1 change: 1 addition & 0 deletions pms_housekeeping/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
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
35 changes: 21 additions & 14 deletions pms_housekeeping/views/pms_housekeeping_task_type_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
<field name="model">pms.housekeeping.task.type</field>
<field name="arch" type="xml">
<tree string="Housekeeping Task Type">
<field name="name" />
<field name="name"/>
<field name="is_automated"/>
<field name="housekeepers" widget="many2many_tags" />
<field name="parent_id" widget="many2many_tags" />
<field name="description" />
<field name="is_automated" />
<field name="clean_event" />
<field name="days_after_clean_event" />
<field name="housekeepers" />
<field name="parent_id" />
<field name="priority" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="is_overnight" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="is_empty" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="is_checkin" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="is_checkout" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="days_after_clean_overnight" attrs="{'invisible': [('is_automated', '==', False), ('is_overnight', '==', False)]}"/>
<field name="days_after_clean_empty" attrs="{'invisible': [('is_automated', '==', False), ('is_empty', '==', False)]}"/>
</tree>
</field>
</record>
Expand All @@ -23,16 +28,18 @@
<field name="arch" type="xml">
<form string="Housekeeping Task Type">
<group>
<field name="name" />
<field name="description" />
<field name="is_automated" />
<field name="clean_event" />
<field
name="days_after_clean_event"
attrs="{'invisible': [('clean_event', '!=', 'overnight'), ('clean_event', '!=', 'empty')]}"
/>
<field name="name"/>
<field name="is_automated"/>
<field name="housekeepers" widget="many2many_tags" />
<field name="parent_id" widget="many2many_tags" />
<field name="description" />
<field name="priority" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="is_overnight" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="is_empty" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="is_checkin" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="is_checkout" attrs="{'invisible': [('is_automated', '==', False)]}"/>
<field name="days_after_clean_overnight" attrs="{'invisible': [('is_automated', '==', False), ('is_overnight', '==', False)]}"/>
<field name="days_after_clean_empty" attrs="{'invisible': [('is_automated', '==', False), ('is_empty', '==', False)]}"/>
</group>
</form>
</field>
Expand Down
47 changes: 47 additions & 0 deletions pms_housekeeping/views/pms_housekeeping_task_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="view_pms_housekeeping_task_tree" model="ir.ui.view">
<field name="name">pms.housekeeping.task.tree</field>
<field name="model">pms.housekeeping.task</field>
<field name="arch" type="xml">
<tree string="Housekeeping Task">
<field name="name" />
<field name="room_id" />
<field name="task_type_id" />
<field name="state"/>
<field name="priority" />
<field name="cleaning_comments" />
<field name="employee_ids" />
<field name="parent_id" />
</tree>
</field>
</record>
<record id="view_pms_housekeeping_task_form" model="ir.ui.view">
<field name="name">pms.housekeeping.task.form</field>
<field name="model">pms.housekeeping.task</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Housekeeping Task">
<header>
<field name="state" widget="statusbar" />
</header>
<group class="col-6">
<field name="name" />
<field name="room_id" />
<field name="task_type_id" />
</group>
<group class="col-6">
<field name="task_datetime" />
<field name="priority" />
<field name="employee_ids" widget="many2many_tags"/>
</group>
<group class="col-12">
<field name="parent_id" widget="many2many_tags"/>
<field name="cleaning_comments" />
</group>
</form>
</field>
</record>
</data>
</odoo>
14 changes: 13 additions & 1 deletion pms_housekeeping/views/pms_housekeeping_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,30 @@
<field name="res_model">pms.housekeeping.task.type</field>
<field name="view_mode">tree,form</field>
</record>
<record model="ir.actions.act_window" id="action_pms_housekeeping_task">
<field name="name">Housekeeping Task</field>
<field name="res_model">pms.housekeeping.task</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
name="Housekeeping"
id="menu_action_pms_housekeeping"
sequence="17"
parent="pms.pms_management_menu"
/>
<menuitem
name="Task Type"
name="Task Types"
id="menu_action_pms_housekeeping_view_task_type"
action="pms_housekeeping.action_pms_housekeeping_task_type"
sequence="10"
parent="pms_housekeeping.menu_action_pms_housekeeping"
/>
<menuitem
name="Tasks"
id="menu_action_pms_housekeeping_view_task"
action="pms_housekeeping.action_pms_housekeeping_task"
sequence="9"
parent="pms_housekeeping.menu_action_pms_housekeeping"
/>
</data>
</odoo>

0 comments on commit 16d1ed3

Please sign in to comment.