Fix reports
This commit is contained in:
parent
06a9844579
commit
68da5f3b88
22
__init__.py
22
__init__.py
|
@ -48,11 +48,6 @@ def register():
|
||||||
booking.BookingForecastStart,
|
booking.BookingForecastStart,
|
||||||
folio.FolioGuest,
|
folio.FolioGuest,
|
||||||
folio.GuestsListStart,
|
folio.GuestsListStart,
|
||||||
# folio.TransferfolioStart,
|
|
||||||
# folio.TransferChargeStart,
|
|
||||||
# folio.CheckOutfolioFailed,
|
|
||||||
# folio.ChangeRoomStart,
|
|
||||||
# folio.folioVoucher,
|
|
||||||
folio.StatisticsByMonthStart,
|
folio.StatisticsByMonthStart,
|
||||||
sale.InvoiceIncomeDailyStart,
|
sale.InvoiceIncomeDailyStart,
|
||||||
service.Service,
|
service.Service,
|
||||||
|
@ -64,6 +59,10 @@ def register():
|
||||||
housekeeping.HotelTask,
|
housekeeping.HotelTask,
|
||||||
housekeeping.HousekeepingServiceStart,
|
housekeeping.HousekeepingServiceStart,
|
||||||
room.CleanningDays,
|
room.CleanningDays,
|
||||||
|
# folio.TransferfolioStart,
|
||||||
|
# folio.TransferChargeStart,
|
||||||
|
# folio.CheckOutfolioFailed,
|
||||||
|
# folio.ChangeRoomStart,
|
||||||
module='hotel', type_='model')
|
module='hotel', type_='model')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
booking.BookingReport,
|
booking.BookingReport,
|
||||||
|
@ -73,13 +72,13 @@ def register():
|
||||||
folio.Migration,
|
folio.Migration,
|
||||||
folio.GuestsListReport,
|
folio.GuestsListReport,
|
||||||
folio.RegistrationCardReport,
|
folio.RegistrationCardReport,
|
||||||
# folio.folioReport,
|
|
||||||
# folio.folioByConsumerReport,
|
|
||||||
folio.StatisticsByMonthReport,
|
folio.StatisticsByMonthReport,
|
||||||
sale.InvoiceIncomeDailyReport,
|
sale.InvoiceIncomeDailyReport,
|
||||||
sale.InvoiceSimplifiedReport,
|
sale.InvoiceSimplifiedReport,
|
||||||
service.ServiceReport,
|
service.ServiceReport,
|
||||||
housekeeping.HousekeepingServiceReport,
|
housekeeping.HousekeepingServiceReport,
|
||||||
|
# folio.folioReport,
|
||||||
|
# folio.folioByConsumerReport,
|
||||||
module='hotel', type_='report')
|
module='hotel', type_='report')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
booking.SelectRooms,
|
booking.SelectRooms,
|
||||||
|
@ -88,14 +87,13 @@ def register():
|
||||||
booking.BookingDaily,
|
booking.BookingDaily,
|
||||||
folio.OpenMigration,
|
folio.OpenMigration,
|
||||||
folio.GuestsList,
|
folio.GuestsList,
|
||||||
# folio.CheckOutfolio,
|
|
||||||
# folio.folioBill,
|
|
||||||
# folio.ChangeRoom,
|
|
||||||
# folio.Transferfolio,
|
|
||||||
# folio.TransferCharge,
|
|
||||||
folio.StatisticsByMonth,
|
folio.StatisticsByMonth,
|
||||||
service.CreateDailyServices,
|
service.CreateDailyServices,
|
||||||
housekeeping.HousekeepingService,
|
housekeeping.HousekeepingService,
|
||||||
sale.InvoiceIncomeDaily,
|
sale.InvoiceIncomeDaily,
|
||||||
party.CreateGuest,
|
party.CreateGuest,
|
||||||
|
# folio.CheckOutfolio,
|
||||||
|
# folio.ChangeRoom,
|
||||||
|
# folio.Transferfolio,
|
||||||
|
# folio.TransferCharge,
|
||||||
module='hotel', type_='wizard')
|
module='hotel', type_='wizard')
|
||||||
|
|
156
booking.py
156
booking.py
|
@ -1046,9 +1046,6 @@ class RoomsOccupancyReport(Report):
|
||||||
else:
|
else:
|
||||||
occupancy_rate = 0
|
occupancy_rate = 0
|
||||||
|
|
||||||
# recs = rooms_map.values()
|
|
||||||
records = rooms_map.values()
|
|
||||||
print('XXXXX.......', rooms_map)
|
|
||||||
report_context['records'] = rooms_map.values()
|
report_context['records'] = rooms_map.values()
|
||||||
report_context['occupancy_rate'] = occupancy_rate
|
report_context['occupancy_rate'] = occupancy_rate
|
||||||
report_context['occupancy_rooms'] = occupancy_rooms
|
report_context['occupancy_rooms'] = occupancy_rooms
|
||||||
|
@ -1132,80 +1129,79 @@ class InvoicePaymentForm(ModelView):
|
||||||
return Date.today()
|
return Date.today()
|
||||||
|
|
||||||
|
|
||||||
class WizardInvoicePayment(Wizard):
|
# class WizardInvoicePayment(Wizard):
|
||||||
'Wizard Invoice Payment'
|
# 'Wizard Invoice Payment'
|
||||||
__name__ = 'invoice.payment'
|
# __name__ = 'invoice.payment'
|
||||||
start = StateView('invoice.payment.form',
|
# start = StateView('invoice.payment.form',
|
||||||
'hotel.invoice_payment_view_form', [
|
# 'hotel.invoice_payment_view_form', [
|
||||||
Button('Cancel', 'end', 'tryton-cancel'),
|
# Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Pay', 'pay_', 'tryton-ok', default=True),
|
# Button('Pay', 'pay_', 'tryton-ok', default=True),
|
||||||
])
|
# ])
|
||||||
pay_ = StateTransition()
|
# pay_ = StateTransition()
|
||||||
|
#
|
||||||
@classmethod
|
# @classmethod
|
||||||
def __setup__(cls):
|
# def __setup__(cls):
|
||||||
super(WizardInvoicePayment, cls).__setup__()
|
# super(WizardInvoicePayment, cls).__setup__()
|
||||||
|
#
|
||||||
def default_start(self, fields):
|
# def default_start(self, fields):
|
||||||
pool = Pool()
|
# pool = Pool()
|
||||||
Booking = pool.get('hotel.booking')
|
# Booking = pool.get('hotel.booking')
|
||||||
Date = pool.get('ir.date')
|
# Date = pool.get('ir.date')
|
||||||
booking = Booking(Transaction().context['active_id'])
|
# booking = Booking(Transaction().context['active_id'])
|
||||||
return {
|
# return {
|
||||||
'payment_amount': booking.pending_to_pay,
|
# 'payment_amount': booking.pending_to_pay,
|
||||||
'party': booking.party.id,
|
# 'party': booking.party.id,
|
||||||
'pay_date': Date.today(),
|
# 'pay_date': Date.today(),
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
def transition_pay_(self):
|
# def transition_pay_(self):
|
||||||
pool = Pool()
|
# pool = Pool()
|
||||||
User = pool.get('res.user')
|
# Booking = pool.get('hotel.booking')
|
||||||
Booking = pool.get('hotel.booking')
|
# Invoice = pool.get('account.invoice')
|
||||||
Invoice = pool.get('account.invoice')
|
# active_id = Transaction().context.get('active_id', False)
|
||||||
active_id = Transaction().context.get('active_id', False)
|
# booking = Booking(active_id)
|
||||||
booking = Booking(active_id)
|
#
|
||||||
|
# invoices = []
|
||||||
invoices = []
|
# for folio in booking.lines:
|
||||||
for folio in booking.lines:
|
# inv = folio.invoice
|
||||||
inv = folio.invoice
|
# if inv.state != 'posted':
|
||||||
if inv.state != 'posted':
|
# continue
|
||||||
continue
|
# invoices.append(inv)
|
||||||
invoices.append(inv)
|
# if not invoices:
|
||||||
if not invoices:
|
# return 'end'
|
||||||
return 'end'
|
#
|
||||||
|
# invoice = invoices[0]
|
||||||
invoice = invoices[0]
|
# invoice.create_move_advance(booking.vouchers)
|
||||||
invoice.create_move_advance(booking.vouchers)
|
#
|
||||||
|
# # if not sale.number:
|
||||||
# if not sale.number:
|
# # Invoice.set_number([sale])
|
||||||
# Invoice.set_number([sale])
|
#
|
||||||
|
# if not invoice.party.account_receivable:
|
||||||
if not invoice.party.account_receivable:
|
# # raise PartyMissingAccount(
|
||||||
# raise PartyMissingAccount(
|
# # gettext('sale_pos.msg_party_without_account_receivable', s=sale.party.name))
|
||||||
# gettext('sale_pos.msg_party_without_account_receivable', s=sale.party.name))
|
# pass
|
||||||
pass
|
# account = invoice.party.account_receivable.id
|
||||||
account = invoice.party.account_receivable.id
|
#
|
||||||
|
# if form.payment_amount:
|
||||||
if form.payment_amount:
|
# payment = StatementLine(
|
||||||
payment = StatementLine(
|
# statement=statements[0].id,
|
||||||
statement=statements[0].id,
|
# date=date.today(),
|
||||||
date=date.today(),
|
# amount=form.payment_amount,
|
||||||
amount=form.payment_amount,
|
# party=sale.party.id,
|
||||||
party=sale.party.id,
|
# account=account,
|
||||||
account=account,
|
# description=self.start.voucher,
|
||||||
description=self.start.voucher,
|
# sale=active_id,
|
||||||
sale=active_id,
|
# # number=self.start.voucher,
|
||||||
# number=self.start.voucher,
|
# # voucher=self.start.voucher,
|
||||||
# voucher=self.start.voucher,
|
# )
|
||||||
)
|
# payment.save()
|
||||||
payment.save()
|
#
|
||||||
|
# if sale.total_amount != sale.paid_amount:
|
||||||
if sale.total_amount != sale.paid_amount:
|
# return 'start'
|
||||||
return 'start'
|
# sale.save()
|
||||||
sale.save()
|
# if self.start.do_invoice:
|
||||||
if self.start.do_invoice:
|
# # for inv in sale.invoices:
|
||||||
# for inv in sale.invoices:
|
# # if inv.state == 'posted':
|
||||||
# if inv.state == 'posted':
|
# # inv.write([inv], {'state': 'draft'})
|
||||||
# inv.write([inv], {'state': 'draft'})
|
# Invoice.workflow_to_end([sale])
|
||||||
Invoice.workflow_to_end([sale])
|
# return 'end'
|
||||||
return 'end'
|
|
||||||
|
|
Binary file not shown.
81
folio.py
81
folio.py
|
@ -1849,53 +1849,52 @@ class GuestsListReport(Report):
|
||||||
report_context = super().get_context(records, header, data)
|
report_context = super().get_context(records, header, data)
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Company = pool.get('company.company')
|
Company = pool.get('company.company')
|
||||||
# Operation = pool.get('hotel.operation')
|
Folio = pool.get('hotel.folio')
|
||||||
Room = pool.get('hotel.room')
|
Room = pool.get('hotel.room')
|
||||||
User = pool.get('res.user')
|
User = pool.get('res.user')
|
||||||
user_id = Transaction().user
|
user_id = Transaction().user
|
||||||
|
|
||||||
user = User(user_id)
|
user = User(user_id)
|
||||||
start_date = data['date']
|
start_date = data['date']
|
||||||
# operations = Operation.search([
|
folios = Folio.search([
|
||||||
# ('start_date', '<=', start_date),
|
('arrival_date', '<=', start_date),
|
||||||
# ('kind', '=', 'occupancy'),
|
('registration_state', '=', 'check_in'),
|
||||||
# ('state', '=', 'open'),
|
], order=[('room.code', 'ASC')])
|
||||||
# ], order=[('room.code', 'ASC')])
|
|
||||||
#
|
total_guests = []
|
||||||
# total_guests = []
|
rooms_occupied = []
|
||||||
# rooms_occupied = []
|
for op in folios:
|
||||||
# for op in operations:
|
total_guests.append(len(op.guests))
|
||||||
# total_guests.append(len(op.guests))
|
rooms_occupied.append(op.room.id)
|
||||||
# rooms_occupied.append(op.room.id)
|
|
||||||
#
|
rooms = Room.search_read([])
|
||||||
# rooms = Room.search_read([])
|
|
||||||
#
|
_rooms_occupied = len(set(rooms_occupied))
|
||||||
# _rooms_occupied = len(set(rooms_occupied))
|
num_rooms = len(rooms)
|
||||||
# num_rooms = len(rooms)
|
if num_rooms:
|
||||||
# if num_rooms:
|
occupancy_rate = round(_rooms_occupied / num_rooms, 2)
|
||||||
# occupancy_rate = round(_rooms_occupied / num_rooms, 2)
|
else:
|
||||||
# else:
|
occupancy_rate = 0
|
||||||
# occupancy_rate = 0
|
|
||||||
#
|
guests = []
|
||||||
# operations_ = []
|
for op in folios:
|
||||||
# for op in operations:
|
for guest in op.guests:
|
||||||
# for guest in op.guests:
|
guests.append({
|
||||||
# operations_.append({
|
'room': op.room.code,
|
||||||
# 'room': op.room.code,
|
'guest': guest.party.name,
|
||||||
# 'guest': guest.party.name,
|
'party': op.party.name if op.party else '',
|
||||||
# 'party': op.party.code,
|
'arrival_date': op.arrival_date,
|
||||||
# 'start_date': op.start_date,
|
'departure_date': op.departure_date,
|
||||||
# 'end_date': op.end_date,
|
'nights_quantity': op.nights_quantity,
|
||||||
# 'nights_quantity': op.nights_quantity,
|
})
|
||||||
# })
|
report_context['records'] = guests
|
||||||
# report_context['records'] = operations_
|
report_context['total_rooms'] = _rooms_occupied
|
||||||
# report_context['total_rooms'] = _rooms_occupied
|
report_context['total_guests'] = sum(total_guests)
|
||||||
# report_context['total_guests'] = sum(total_guests)
|
report_context['occupancy_rate'] = occupancy_rate
|
||||||
# report_context['occupancy_rate'] = occupancy_rate
|
report_context['company'] = Company(data['company']).party.name
|
||||||
# report_context['company'] = Company(data['company']).party.name
|
report_context['date'] = data['date']
|
||||||
# report_context['date'] = data['date']
|
report_context['print_date'] = datetime.now()
|
||||||
# report_context['print_date'] = datetime.now()
|
report_context['user'] = user.name
|
||||||
# report_context['user'] = user.name
|
|
||||||
return report_context
|
return report_context
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
guests_list.fods
BIN
guests_list.fods
Binary file not shown.
Loading…
Reference in New Issue