diff --git a/booking.py b/booking.py index 75855a1..93ace23 100644 --- a/booking.py +++ b/booking.py @@ -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 diff --git a/folio.py b/folio.py index 09831d1..9647140 100644 --- a/folio.py +++ b/folio.py @@ -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']), diff --git a/folio.xml b/folio.xml index 39e5ae5..134a7ee 100644 --- a/folio.xml +++ b/folio.xml @@ -138,6 +138,33 @@ this repository contains the full copyright notices and license terms. --> + + hotel.folio.guest + tree + board_folio_guest_tree + + + hotel.folio.guest + form + board_folio_guest_form + + + Guests + hotel.folio.guest + + + + + + + + + + + + + hotel-housekeeping icons/housekeeping.svg + + hotel-guests + icons/guests.svg + diff --git a/housekeeping.py b/housekeeping.py index cc2ea66..da000ca 100644 --- a/housekeeping.py +++ b/housekeeping.py @@ -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() diff --git a/icons/guests.svg b/icons/guests.svg new file mode 100644 index 0000000..1acbf41 --- /dev/null +++ b/icons/guests.svg @@ -0,0 +1 @@ +guest-traveler \ No newline at end of file diff --git a/registration_card.fodt b/registration_card.fodt index 1a7a515..9c0143d 100644 Binary files a/registration_card.fodt and b/registration_card.fodt differ diff --git a/rooms_occupancy.fods b/rooms_occupancy.fods index 9e35545..366831a 100644 Binary files a/rooms_occupancy.fods and b/rooms_occupancy.fods differ diff --git a/tryton.cfg b/tryton.cfg index ad66776..66aef7c 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.0.11 +version=6.0.12 depends: party company diff --git a/view/board_folio_form.xml b/view/board_folio_form.xml index a92f33d..a227358 100644 --- a/view/board_folio_form.xml +++ b/view/board_folio_form.xml @@ -30,6 +30,8 @@ this repository contains the full copyright notices and license terms. -->