This commit is contained in:
oscar alvarez 2022-05-17 10:14:08 -05:00
parent 3b31c99d54
commit 8a89d25999
17 changed files with 130 additions and 32 deletions

View File

@ -166,6 +166,7 @@ class Booking(Workflow, ModelSQL, ModelView):
('cancelled', 'offer'),
('confirmed', 'cancelled'),
('confirmed', 'not_show'),
('not_show', 'confirmed'),
))
cls._buttons.update({
'select_rooms': {
@ -1193,6 +1194,7 @@ class RoomsOccupancyReport(Report):
all_rooms = Room.search([], order=[('code', 'ASC')])
folios = Folio.search([
('arrival_date', '<=', start_date),
('departure_date', '>=', start_date),
('registration_state', '=', 'check_in'),
])
@ -1208,22 +1210,24 @@ class RoomsOccupancyReport(Report):
'registration_card': None,
'amount': 0,
'registration_state': None,
'total_balance': 0,
}
return res
rooms_map = {room.id: _get_default_room(room) for room in all_rooms}
occupancy_rooms = 0
for op in folios:
rooms_map[op.room.id].update({
'guest': op.main_guest.name,
'num_guest': len(op.guests),
'party': op.booking.party.name if op.booking.party else '',
'arrival': op.arrival_date,
'departure': op.departure_date,
'registration_card': op.registration_card,
'amount': op.total_amount,
'booking': op.booking.number,
'registration_state': op.registration_state,
for fo in folios:
rooms_map[fo.room.id].update({
'guest': fo.main_guest.name,
'num_guest': len(fo.guests),
'party': fo.booking.party.name if fo.booking.party else '',
'arrival': fo.arrival_date,
'departure': fo.departure_date,
'registration_card': fo.registration_card,
'amount': fo.total_amount,
'booking': fo.booking.number,
'registration_state': fo.registration_state_string,
'total_balance': fo.total_balance,
})
occupancy_rooms += 1
@ -1235,7 +1239,7 @@ class RoomsOccupancyReport(Report):
report_context['records'] = rooms_map.values()
report_context['occupancy_rate'] = occupancy_rate
report_context['occupancy_rooms'] = occupancy_rooms
report_context['company'] = Company(data['company']).party.name
report_context['company'] = Company(data['company'])
report_context['date'] = data['date']
report_context['user'] = User(Transaction().user).rec_name
return report_context

View File

@ -79,6 +79,8 @@ class Folio(ModelSQL, ModelView):
nights_quantity = fields.Integer('Nights', states={'readonly': True},
depends=['arrival_date', 'departure_date'])
host_quantity = fields.Integer('Host', states=STATES_CHECKIN)
estimated_arrival_time = fields.Time('Estimated Arrival Time',
states=STATES_CHECKIN)
unit_digits = fields.Function(fields.Integer('Unit Digits'), 'get_unit_digits')
notes = fields.Text('Notes')
total_amount = fields.Function(fields.Numeric('Total Amount',
@ -98,6 +100,7 @@ class Folio(ModelSQL, ModelView):
select=True, states=STATES_CHECKIN)
registration_state = fields.Selection(REGISTRATION_STATE,
'Registration State', readonly=True, select=True)
registration_state_string = registration_state.translated('registration_state')
charges = fields.One2Many('hotel.folio.charge', 'folio', 'Charges',
states={
'readonly': ~Eval('registration_state').in_(['check_in']),

View File

@ -138,6 +138,33 @@ this repository contains the full copyright notices and license terms. -->
<field name="action" ref="act_folio_reverse_checkout"/>
</record>
<record model="ir.ui.view" id="board_folio_guest_view_tree">
<field name="model">hotel.folio.guest</field>
<field name="type">tree</field>
<field name="name">board_folio_guest_tree</field>
</record>
<record model="ir.ui.view" id="board_folio_guest_view_form">
<field name="model">hotel.folio.guest</field>
<field name="type">form</field>
<field name="name">board_folio_guest_form</field>
</record>
<record model="ir.action.act_window" id="act_board_folio_guest_view">
<field name="name">Guests</field>
<field name="res_model">hotel.folio.guest</field>
</record>
<record model="ir.action.act_window.view" id="act_hotel_board_folio_guest_tree_view">
<field name="sequence" eval="1"/>
<field name="view" ref="board_folio_guest_view_tree"/>
<field name="act_window" ref="act_board_folio_guest_view"/>
</record>
<record model="ir.action.act_window.view" id="act_hotel_board_folio_guest_form_view">
<field name="sequence" eval="2"/>
<field name="view" ref="board_folio_guest_view_form"/>
<field name="act_window" ref="act_board_folio_guest_view"/>
</record>
<menuitem parent="menu_hotel" sequence="20" icon="hotel-guests"
action="act_board_folio_guest_view" id="menu_hotel_board_guest_folio"/>
<!-- <record model="ir.ui.view" id="operation_maintenance_view_tree">
<field name="model">hotel.operation.maintenance</field>
<field name="type">tree</field>

View File

@ -35,6 +35,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">hotel-housekeeping</field>
<field name="path">icons/housekeeping.svg</field>
</record>
<record model="ir.ui.icon" id="hotel_guests_icon">
<field name="name">hotel-guests</field>
<field name="path">icons/guests.svg</field>
</record>
<menuitem name="Hotel" sequence="10" id="menu_hotel"
icon="tryton-hotel" />

View File

@ -46,6 +46,8 @@ class Housekeeping(Workflow, ModelSQL, ModelView):
notes = fields.Text('Notes')
check_in_time = fields.Function(fields.Time('Check In Time'), 'get_check_in_time')
check_out_time = fields.Function(fields.Time('Check In Time'), 'get_check_out_time')
amenities = fields.Funtion(fields.Many2Many('hotel.room-hotel.amenities',
'room', 'amenities', 'Amenities'), 'get_amenities')
@classmethod
def __setup__(cls):
@ -132,18 +134,25 @@ class Housekeeping(Workflow, ModelSQL, ModelView):
if lines:
return config.check_in_time.strftime('%H:%M %p')
def get_amenities(self, name=None):
res = []
for ame in room.amenities:
res.append(ame.id)
return res
def get_check_out_time(self, name):
pool = Pool()
Date = pool.get('ir.date')
Configuration = pool.get('hotel.configuration')
Operation = pool.get('hotel.operation')
config = Configuration.get_configuration()
operations = Operation.search_read([
('room', '=', self.room.id),
('end_date', '=', Date.today()),
], fields_names=['id'])
if operations:
return config.check_out_time.strftime('%H:%M %p')
# pool = Pool()
# Date = pool.get('ir.date')
# Configuration = pool.get('hotel.configuration')
# Operation = pool.get('hotel.operation')
# config = Configuration.get_configuration()
# operations = Operation.search_read([
# ('room', '=', self.room.id),
# ('end_date', '=', Date.today()),
# ], fields_names=['id'])
# if operations:
# return config.check_out_time.strftime('%H:%M %p')
pass
# def get_occupancies(self, name):
# pool = Pool()

1
icons/guests.svg Normal file
View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 122.88 120.05"><defs><style>.cls-1{fill-rule:evenodd;}</style></defs><title>guest-traveler</title><path class="cls-1" d="M90.54,38.25c2.23-.75,4.58.44,6.13,2.3h18.46a.51.51,0,0,1,.51.51v4.86a.51.51,0,0,1-.51.51H111.9V62.62h-3.73V46.43H98.11a9.11,9.11,0,0,1-2.36,3.36V62.62H92V52.41a57.27,57.27,0,0,1-8,3.38,84.35,84.35,0,0,1-9,2.79,18,18,0,0,1-15.71-4,41.48,41.48,0,0,1-3.49-3.35l-.34-.36-3,17.75a62.39,62.39,0,0,0,7.2,4.17c7.78,3.63,14.18,6.63,15.55,18.85.25,2.14.14,14.68,0,20.84H86a1.8,1.8,0,0,1-.67-1.43v-1.89a4.77,4.77,0,0,1-4.71-4.76v-36a4.78,4.78,0,0,1,4.76-4.76h1.09a.91.91,0,0,0,0,.23l1.19,4.54a7.4,7.4,0,0,0,1.79,3.38A4.22,4.22,0,0,0,92.58,73h4.77v2.55c0,.41,1.92.73,2.32.73H106a.72.72,0,0,0,.73-.72V73h5a4.36,4.36,0,0,0,3.16-1.32,6.81,6.81,0,0,0,1.72-3.4l1-4.48a1,1,0,0,0,0-.24h.51a4.78,4.78,0,0,1,4.76,4.76v36.05a4.77,4.77,0,0,1-4.71,4.76V111a1.8,1.8,0,0,1-.67,1.43h5.38v7.58H0v-7.58H19.83c1.41-3.79,2.86-7.83,4.28-11.89,2.93-8.39,5.74-17,7.8-23.84a22,22,0,0,1-3.21-5.06A11.33,11.33,0,0,1,27.82,65l4.33-21.82c-1.55-.08-3.34-.54-4.8.1-2.83,1.24-7,6.52-9.47,9l-3.31,3.35c-2.55,2.58-4.25,5.44-8.15,5.13-4.84-.38-8.3-5.76-4.89-9.89l7.63-7.72c3.67-3.73,7.16-8.12,11.69-10.68C24.49,30.41,28.45,29,35,29.28c2.4,0,4.94.27,7.34.5l2.8.24c11,.71,16.12,6.5,20.12,11,1.77,2,3.29,3.7,4.94,4.49.78.37,2-.15,3.39-.73L83.76,41l6.78-2.72ZM61.15,112.47c.14-6.94.29-16.73.18-18.62-.09-1.35-1-4.92-2.42-5.57a59.35,59.35,0,0,0-5.83-2.17c-2.75-.91-5-1.83-7.72-2.58-2,6.58-4.68,14.52-7.57,22.09l-2.73,6.85Zm52.87,0H89.49a1.77,1.77,0,0,0,.67-1.43v-1.89h23.19V111a1.77,1.77,0,0,0,.67,1.43ZM88.91,100.24a.88.88,0,0,1,0-1.76h25.82a.88.88,0,0,1,0,1.76Zm0-8.51a.88.88,0,0,1,0-1.76h25.82a.88.88,0,1,1,0,1.76Zm0-8.51a.88.88,0,0,1,0-1.76h25.82a.88.88,0,1,1,0,1.76Zm26.73-18.75H88.5l.9,3.43a5.63,5.63,0,0,0,1.34,2.58,2.49,2.49,0,0,0,1.83.78h19.17a2.65,2.65,0,0,0,1.92-.81,5.09,5.09,0,0,0,1.24-2.51l.74-3.47ZM44.82.71a13.17,13.17,0,1,1-7.56,6.66A13.13,13.13,0,0,1,44.82.71Z"/></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
[tryton]
version=6.0.11
version=6.0.12
depends:
party
company

View File

@ -30,6 +30,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="unit_price_w_tax"/>
<label name="reference"/>
<field name="reference"/>
<label name="estimated_arrival_time"/>
<field name="estimated_arrival_time"/>
<notebook colspan="6">
<page string="Charges" id="hotel_charges">
<field name="charges" colspan="4"/>

View File

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form col="6">
<label name="party"/>
<field name="party"/>
<label name="folio"/>
<field name="folio"/>
<label name="type_guest"/>
<field name="type_guest"/>
<label name="nationality"/>
<field name="nationality" widget="selection"/>
<label name="type_document"/>
<field name="type_document"/>
<label name="doc_number"/>
<field name="doc_number"/>
<label name="mobile"/>
<field name="mobile"/>
<label name="email"/>
<field name="email"/>
<label name="sex"/>
<field name="sex"/>
<label name="origin_country"/>
<field name="origin_country" widget="selection"/>
<label name="target_country"/>
<field name="target_country" widget="selection"/>
</form>

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="folio"/>
<field name="party" expand="1"/>
<field name="type_guest"/>
<field name="nationality" widget="selection"/>
<field name="type_document"/>
<field name="doc_number"/>
<field name="mobile"/>
<field name="email"/>
<field name="sex"/>
</tree>

View File

@ -11,10 +11,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="nights_quantity"/>
<field name="arrival_date"/>
<field name="departure_date"/>
<field name="registration_state"/>
<field name="reference"/>
<field name="estimated_arrival_time"/>
<field name="channel"/>
<field name="invoice_state"/>
<field name="reference"/>
<field name="registration_state"/>
<field name="unit_price"/>
<field name="total_amount"/>
<field name="invoice_state"/>
</tree>

View File

@ -32,6 +32,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="room_amount"/>
<label name="reference"/>
<field name="reference"/>
<label name="estimated_arrival_time"/>
<field name="estimated_arrival_time"/>
<notebook colspan="6">
<page string="Charges" id="hotel_charges">
<field name="charges" colspan="4"/>

View File

@ -2,9 +2,9 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree editable="1">
<field name="party"/>
<field name="party" expand="1"/>
<field name="type_document"/>
<field name="name"/>
<field name="name" expand="1"/>
<field name="doc_number"/>
<field name="mobile"/>
<field name="email"/>

View File

@ -21,10 +21,14 @@ this repository contains the full copyright notices and license terms. -->
<field name="tasks" colspan="4"/>
</page>
<page string="Info Addtional" id="comments">
<group col="1" colspan="2" string="Check List" id="check_list">
<field name="check_list" colspan="4"/>
</group>
<field name="amenities" colspan="2"/>
<separator string="Notes" colspan="4" id="configuration_room"/>
<field name="notes" colspan="4"/>
<separator string="Check List" colspan="4" id="check_list"/>
<field name="check_list" colspan="4"/>
</page>
<page string="Amenities" id="amenities">
</page>
</notebook>
<group col="5" colspan="4" id="buttons">

View File

@ -5,5 +5,5 @@ this repository contains the full copyright notices and license terms. -->
<label name="date"/>
<field name="date"/>
<label name="company"/>
<field name="company"/>
<field name="company" widget="selection"/>
</form>