Fix
This commit is contained in:
parent
3a3cb446ac
commit
bc1c7f714c
|
@ -0,0 +1 @@
|
|||
,psk,Acer,09.08.2022 15:10,file:///home/psk/.config/libreoffice/4;
|
Binary file not shown.
18
room.py
18
room.py
|
@ -65,6 +65,7 @@ class Room(Workflow, ModelSQL, ModelView):
|
|||
last_clean = fields.DateTime('Last Clean')
|
||||
housekeeping = fields.Many2One('company.employee', 'Employee')
|
||||
notes = fields.Text('Notes')
|
||||
guests = fields.Function(fields.Integer('Guests'), 'get_guests')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -135,6 +136,19 @@ class Room(Workflow, ModelSQL, ModelView):
|
|||
def inspected(cls, records):
|
||||
pass
|
||||
|
||||
def get_guests(self, name=None):
|
||||
pool = Pool()
|
||||
Folio = pool.get('hotel.folio')
|
||||
folios = Folio.search([
|
||||
('room', '=', self.id),
|
||||
('arrival_date', '<=', date.today()),
|
||||
('departure_date', '>', date.today())
|
||||
])
|
||||
res = []
|
||||
for folio in folios:
|
||||
res.append(len(folio.guests))
|
||||
return sum(res)
|
||||
|
||||
def get_cleaning_type(self, name=None):
|
||||
pool = Pool()
|
||||
Config = pool.get('hotel.configuration')
|
||||
|
@ -277,9 +291,13 @@ class HousekeepingReport(Report):
|
|||
dom.append(('employee.id', '=', data['employee']))
|
||||
|
||||
rooms = Room.search(dom)
|
||||
total_guests = []
|
||||
for room in rooms:
|
||||
total_guests.append(room.guests)
|
||||
report_context['records'] = rooms
|
||||
report_context['company'] = Company(data['company'])
|
||||
report_context['date'] = datetime.now()
|
||||
report_context['total_guests'] = sum(total_guests)
|
||||
return report_context
|
||||
|
||||
|
||||
|
|
BIN
service.fods
BIN
service.fods
Binary file not shown.
44
service.py
44
service.py
|
@ -26,6 +26,8 @@ class ServiceKind(ModelSQL, ModelView):
|
|||
salable = fields.Boolean('Salable')
|
||||
category = fields.Selection([
|
||||
('breakfast', 'Breakfast'),
|
||||
('lunch', 'Lunch'),
|
||||
('dinner', 'Dinner'),
|
||||
('restaurant', 'Restaurant'),
|
||||
('laundry', 'Laundry'),
|
||||
('spa', 'Spa'),
|
||||
|
@ -120,7 +122,7 @@ class Service(Workflow, ModelSQL, ModelView):
|
|||
pass
|
||||
|
||||
def get_count_services(self, name=None):
|
||||
return len(self.lines)
|
||||
return sum([line.quantity for line in self.lines])
|
||||
|
||||
@classmethod
|
||||
def set_number(cls, services):
|
||||
|
@ -287,7 +289,7 @@ class CreateDailyServicesStart(ModelView):
|
|||
__name__ = 'hotel.daily_services.start'
|
||||
kind = fields.Many2One('hotel.service.kind', 'Kind', required=True,
|
||||
domain=[
|
||||
('category', '=', 'breakfast'),
|
||||
('category', 'in', ['breakfast', 'dinner', 'lunch']),
|
||||
('product', '!=', None)
|
||||
])
|
||||
date = fields.Date('Date', required=True)
|
||||
|
@ -313,26 +315,44 @@ class CreateDailyServices(Wizard):
|
|||
pool = Pool()
|
||||
Service = pool.get('hotel.service')
|
||||
Folio = pool.get('hotel.folio')
|
||||
|
||||
folios = Folio.search([
|
||||
('arrival_date', '<', self.start.date),
|
||||
('departure_date', '>=', self.start.date),
|
||||
('registration_state', 'in', ['check_in']),
|
||||
])
|
||||
kind = self.start.kind
|
||||
if kind == 'breakfast':
|
||||
dom = [
|
||||
('arrival_date', '<', self.start.date),
|
||||
('departure_date', '>=', self.start.date),
|
||||
('registration_state', 'in', ['check_in']),
|
||||
]
|
||||
elif kind == 'lunch':
|
||||
dom = [
|
||||
('arrival_date', '<', self.start.date),
|
||||
('departure_date', '>', self.start.date),
|
||||
('registration_state', 'in', ['check_in', 'check_out']),
|
||||
]
|
||||
else: # self.kind == 'dinner':
|
||||
dom = [
|
||||
('arrival_date', '<=', self.start.date),
|
||||
('departure_date', '>', self.start.date),
|
||||
('registration_state', 'in', ['check_in', 'pending']),
|
||||
]
|
||||
folios = Folio.search(dom)
|
||||
|
||||
lines_to_create = []
|
||||
service, = Service.create([{
|
||||
'service_date': self.start.date,
|
||||
'state': 'draft',
|
||||
'kind': self.start.kind.id,
|
||||
'kind': kind.id,
|
||||
}])
|
||||
Service.open([service])
|
||||
product = self.start.kind.product
|
||||
product = kind.product
|
||||
for fol in folios:
|
||||
if not fol.breakfast_included:
|
||||
booking = fol.booking
|
||||
if booking.plan == 'no_breakfast':
|
||||
continue
|
||||
if kind == 'lunch' and booking.plan in ['half_american', 'bed_breakfast'] :
|
||||
continue
|
||||
if kind == 'dinner' and booking.plan == 'bed_breakfast':
|
||||
continue
|
||||
for guest in fol.guests:
|
||||
|
||||
lines_to_create.append({
|
||||
'folio': fol.id,
|
||||
'service': service.id,
|
||||
|
|
|
@ -143,7 +143,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="act_window" ref="act_service_kind_tree"/>
|
||||
</record>
|
||||
<menuitem parent="hotel.menu_configuration" id="menu_hotel_service_kind"
|
||||
sequence="10" action="act_service_kind_tree"/>
|
||||
sequence="60" action="act_service_kind_tree"/>
|
||||
|
||||
<record model="ir.ui.view" id="create_daily_services_start_view_form">
|
||||
<field name="model">hotel.daily_services.start</field>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.26
|
||||
version=6.0.27
|
||||
depends:
|
||||
party
|
||||
company
|
||||
|
|
|
@ -4,7 +4,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<tree editable="1">
|
||||
<field name="room" widget="selection"/>
|
||||
<field name="guest"/>
|
||||
<field name="folio"/>
|
||||
<field name="folio" expand="1"/>
|
||||
<field name="time_service"/>
|
||||
<field name="product"/>
|
||||
<button name="load" string="Load"/>
|
||||
|
|
|
@ -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>
|
||||
<field name="service_date"/>
|
||||
<field name="number"/>
|
||||
<field name="kind"/>
|
||||
<field name="service_date"/>
|
||||
<field name="state"/>
|
||||
<field name="service_date" expand="1"/>
|
||||
<field name="number" expand="1"/>
|
||||
<field name="kind" expand="1"/>
|
||||
<field name="service_date" expand="1"/>
|
||||
<field name="state" expand="1"/>
|
||||
</tree>
|
||||
|
|
Loading…
Reference in New Issue