Browse Source

July 15: [FIX] Bug Fixed 'hotel_management_odoo'

pull/332/merge
RisvanaCybro 10 months ago
parent
commit
3760dae7df
  1. 2
      hotel_management_odoo/__manifest__.py
  2. 6
      hotel_management_odoo/doc/RELEASE_NOTES.md
  3. 23
      hotel_management_odoo/models/cleaning_request.py
  4. 22
      hotel_management_odoo/models/maintenance_request.py
  5. 10
      hotel_management_odoo/models/room_booking.py
  6. 6
      hotel_management_odoo/views/cleaning_request_views.xml
  7. 9
      hotel_management_odoo/views/maintenance_request_views.xml
  8. 2
      hotel_management_odoo/views/room_booking_views.xml

2
hotel_management_odoo/__manifest__.py

@ -21,7 +21,7 @@
################################################################################ ################################################################################
{ {
'name': 'Hotel Management', 'name': 'Hotel Management',
'version': '16.0.1.0.0', 'version': '16.0.1.1.1',
'category': 'Industries', 'category': 'Industries',
'summary': """A complete Hotel Management System that cover all areas of 'summary': """A complete Hotel Management System that cover all areas of
Hotel services""" , Hotel services""" ,

6
hotel_management_odoo/doc/RELEASE_NOTES.md

@ -5,3 +5,9 @@
#### ADD #### ADD
- Initial commit for Hotel Management - Initial commit for Hotel Management
#### 05.07.2024
#### Version 16.0.1.1.1
#### UPDATE
- Corrected the work flow of deleting and canceling records in room booking model
- Updated the workflow maintenance request and cleaning request model(removed a field from each)

23
hotel_management_odoo/models/cleaning_request.py

@ -47,8 +47,8 @@ class CleaningRequest(models.Model):
string="Cleaning Type", string="Cleaning Type",
help="Choose what is to be cleaned") help="Choose what is to be cleaned")
room_id = fields.Many2one('hotel.room', string="Room", room_id = fields.Many2one('hotel.room', string="Room",
help="Choose the room") help="Choose the room", required=True)
hotel = fields.Char(string="Hotel", help="cleaning request space in hotel") hotel = fields.Char(string="Hotel", help="Cleaning request space in hotel")
vehicle_id = fields.Many2one('fleet.vehicle.model', vehicle_id = fields.Many2one('fleet.vehicle.model',
string="Vehicle", string="Vehicle",
help="Cleaning request from vehicle") help="Cleaning request from vehicle")
@ -68,9 +68,16 @@ class CleaningRequest(models.Model):
assigned_id = fields.Many2one('res.users', string="Assigned To", assigned_id = fields.Many2one('res.users', string="Assigned To",
help="The team member to whom the request is " help="The team member to whom the request is "
"Assigned To") "Assigned To")
domain_partner_ids = fields.Many2many('res.partner', team_member_ids = fields.Many2many('res.users', compute='_compute_team_member_ids', store=False,
string="Domain Partner", help='For filtering Users')
help="Choose the Domain Partner")
@api.depends('team_id')
def _compute_team_member_ids(self):
for record in self:
if record.team_id:
record.team_member_ids = record.team_id.member_ids.ids
else:
record.team_member_ids = []
@api.model @api.model
def create(self, vals_list): def create(self, vals_list):
@ -80,12 +87,6 @@ class CleaningRequest(models.Model):
'cleaning.request') 'cleaning.request')
return super().create(vals_list) return super().create(vals_list)
@api.onchange('team_id')
def _onchange_team_id(self):
"""Function for updating the domain partner ids"""
self.update(
{'domain_partner_ids': self.team_id.member_ids.ids})
def action_assign_cleaning(self): def action_assign_cleaning(self):
"""Button action for updating the state to assign""" """Button action for updating the state to assign"""
self.update({'state': 'assign'}) self.update({'state': 'assign'})

22
hotel_management_odoo/models/maintenance_request.py

@ -69,7 +69,7 @@ class MaintenanceRequest(models.Model):
help="The type for which the request is creating", help="The type for which the request is creating",
tracking=True) tracking=True)
room_maintenance_ids = fields.Many2many('hotel.room', room_maintenance_ids = fields.Many2many('hotel.room',
string="Room Maintenance", string="Room Maintenance", required=True,
help="Choose Room Maintenance") help="Choose Room Maintenance")
hotel_maintenance = fields.Char(string='Hotel Maintenance', hotel_maintenance = fields.Char(string='Hotel Maintenance',
help="This is the Hotel Maintenance") help="This is the Hotel Maintenance")
@ -84,9 +84,16 @@ class MaintenanceRequest(models.Model):
support_reason = fields.Char(string='Support', support_reason = fields.Char(string='Support',
help="Reason for adding Support") help="Reason for adding Support")
remarks = fields.Char(string='Remarks', help="Add Remarks") remarks = fields.Char(string='Remarks', help="Add Remarks")
domain_partner_ids = fields.Many2many('res.partner', team_member_ids = fields.Many2many('res.users', compute='_compute_team_member_ids', store=False,
string="Partner", help='For filtering Users')
help="For filtering Users")
@api.depends('team_id')
def _compute_team_member_ids(self):
for record in self:
if record.team_id:
record.team_member_ids = record.team_id.member_ids.ids
else:
record.team_member_ids = []
@api.model @api.model
def create(self, vals_list): def create(self, vals_list):
@ -96,13 +103,6 @@ class MaintenanceRequest(models.Model):
'maintenance.request') 'maintenance.request')
return super().create(vals_list) return super().create(vals_list)
@api.onchange('team_id')
def _onchange_team_id(self):
"""Function for filtering the maintenance team user"""
self.update({
'domain_partner_ids': self.team_id.member_ids.ids
})
def action_assign_team(self): def action_assign_team(self):
"""Button action for changing the state to team_leader_approve""" """Button action for changing the state to team_leader_approve"""
if self.team_id: if self.team_id:

10
hotel_management_odoo/models/room_booking.py

@ -60,9 +60,7 @@ class RoomBooking(models.Model):
"once") "once")
checkin_date = fields.Datetime(string="Check In", checkin_date = fields.Datetime(string="Check In",
help="Date of Checkin", help="Date of Checkin",
states={"draft": [("readonly", False)]}, default=fields.Datetime.now())
default=fields.Datetime.now()
)
checkout_date = fields.Datetime(string="Check Out", checkout_date = fields.Datetime(string="Check Out",
help="Date of Checkout", help="Date of Checkout",
states={"draft": [("readonly", False)]}, states={"draft": [("readonly", False)]},
@ -238,6 +236,12 @@ class RoomBooking(models.Model):
help="This is the Total Amount for " help="This is the Total Amount for "
"Fleet", tracking=5) "Fleet", tracking=5)
def unlink(self):
for rec in self:
if rec.state != 'cancel' and rec.state != 'draft':
raise ValidationError('Cannot delete the Booking. Cancel the Booking ')
return super().unlink()
@api.model @api.model
def create(self, vals_list): def create(self, vals_list):
"""Sequence Generation""" """Sequence Generation"""

6
hotel_management_odoo/views/cleaning_request_views.xml

@ -67,13 +67,13 @@
</group> </group>
<group> <group>
<field name="head_id"/> <field name="head_id"/>
<field name="team_member_ids" invisible="1"/>
<field name="assigned_id" <field name="assigned_id"
domain="[('id','in',domain_partner_ids)]" domain="[('id','in',team_member_ids)]"
options="{'no_create': True}"/> options="{'no_create': True}"/>
<field name="domain_partner_ids" invisible="1"/>
<field name="support_team_ids" <field name="support_team_ids"
widget="many2many_tags" widget="many2many_tags"
domain="[('id', 'in',domain_partner_ids), domain="[('id', 'in',team_member_ids),
('id', '!=', assigned_id)]" ('id', '!=', assigned_id)]"
attrs="{'invisible':[('state', 'not in', attrs="{'invisible':[('state', 'not in',
'support')]}" 'support')]}"

9
hotel_management_odoo/views/maintenance_request_views.xml

@ -68,13 +68,15 @@
<group> <group>
<field name="team_id"/> <field name="team_id"/>
<field name="team_head_id"/> <field name="team_head_id"/>
<field name="team_member_ids"
invisible="1"/>
<field name="assigned_user_id" <field name="assigned_user_id"
domain="[('id', 'in',domain_partner_ids)]" domain="[('id', 'in',team_member_ids)]"
options="{'no_create': True}" options="{'no_create': True}"
attrs="{'invisible':[('state', '=','draft')]}"/> attrs="{'invisible':[('state', '=','draft')]}"/>
<field name="support_team_ids" <field name="support_team_ids"
widget="many2many_tags" widget="many2many_tags"
domain="[('id', 'in',domain_partner_ids), domain="[('id', 'in',team_member_ids),
('id', '!=', assigned_user_id)]" ('id', '!=', assigned_user_id)]"
attrs="{'invisible':[('state', 'not in', attrs="{'invisible':[('state', 'not in',
'support')]}" 'support')]}"
@ -83,8 +85,7 @@
<field name="remarks" <field name="remarks"
attrs="{'invisible':[('state', 'not in', attrs="{'invisible':[('state', 'not in',
'ongoing')]}"/> 'ongoing')]}"/>
<field name="domain_partner_ids"
invisible="1"/>
</group> </group>
</group> </group>
</sheet> </sheet>

2
hotel_management_odoo/views/room_booking_views.xml

@ -34,7 +34,7 @@
/> />
<button name="action_cancel" <button name="action_cancel"
string="Cancel" string="Cancel"
attrs="{'invisible':[('state', 'not in',['draft','reserved'])]}" attrs="{'invisible':[('state', 'in',['done','cancel'])]}"
type="object" type="object"
class="btn-secondary" class="btn-secondary"
/> />

Loading…
Cancel
Save