Redesign format housekeeping

This commit is contained in:
oscar alvarez 2022-07-27 23:42:24 -05:00
parent 2e6cd726be
commit d22a1b344b
7 changed files with 34 additions and 21 deletions

View File

@ -1058,13 +1058,6 @@ class SelectRoomsAsk(ModelView):
'Targets'), 'on_change_with_targets')
unit_price = fields.Numeric('Unit Price', digits=(16, 4), required=True)
@staticmethod
def default_accommodation():
Configuration = Pool().get('hotel.configuration')
config = Configuration.get_configuration()
if config.default_accommodation:
return config.default_accommodation.id
@fields.depends('accommodation', 'departure_date', 'arrival_date')
def on_change_with_unit_price(self):
Booking = Pool().get('hotel.booking')

View File

@ -260,12 +260,14 @@ class Folio(ModelSQL, ModelView):
Configuration = pool.get('hotel.configuration')
config = Configuration.get_configuration()
cleaning_type_id = None
room = folio.room
if status in 'check_in' and config.cleaning_occupied:
cleaning_type_id = config.cleaning_occupied.id
room.last_check_in = datetime.now()
elif status in 'check_out' and config.cleaning_check_out:
cleaning_type_id = config.cleaning_check_out.id
room.last_check_out = datetime.now()
room = folio.room
room.state = 'dirty'
if cleaning_type_id:
room.cleaning_type = cleaning_type_id

Binary file not shown.

10
room.py
View File

@ -1,5 +1,7 @@
#This file is part of Presik. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from datetime import datetime
from trytond.model import ModelView, ModelSQL, Workflow, fields
from trytond.pyson import Eval
from trytond.wizard import (
@ -7,6 +9,7 @@ from trytond.wizard import (
)
from trytond.pool import Pool
from trytond.report import Report
from trytond.transaction import Transaction
class CleaningType(ModelSQL, ModelView):
@ -58,6 +61,7 @@ class Room(Workflow, ModelSQL, ModelView):
'Cleaning Type', required=False)
last_check_in = fields.DateTime('Last Check In')
last_check_out = fields.DateTime('Last Check Out')
last_clean = fields.DateTime('Last Clean')
housekeeping = fields.Many2One('company.employee', 'Employee')
notes = fields.Text('Notes')
@ -237,14 +241,14 @@ class HousekeepingReport(Report):
report_context = super().get_context(records, header, data)
pool = Pool()
Company = pool.get('company.company')
Housekeeping = pool.get('hotel.housekeeping')
Room = pool.get('hotel.room')
dom = []
if data['employee']:
dom.append(('employee.id', '=', data['employee']))
housekeepings = Housekeeping.search(dom)
report_context['records'] = housekeepings
rooms = Room.search(dom)
report_context['records'] = rooms
report_context['company'] = Company(data['company'])
report_context['date'] = datetime.now()
return report_context

View File

@ -8,8 +8,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="housekeeping" widget="selection"/>
<label name="cleaning_type"/>
<field name="cleaning_type" widget="selection"/>
<label name="state"/>
<field name="state"/>
<label name="last_clean"/>
<field name="last_clean"/>
<notebook colspan="4">
<page string="Tasks" id="tasks">
<!-- <field name="tasks" colspan="2"/> -->
@ -30,4 +30,12 @@ this repository contains the full copyright notices and license terms. -->
<button name="maintenance" string="Maintenance"
icon="tryton-cancel"/>
</group>
<group col="6" colspan="4" id="state_times">
<label name="state"/>
<field name="state"/>
<label name="last_check_in"/>
<field name="last_check_in"/>
<label name="last_check_out"/>
<field name="last_check_out"/>
</group>
</form>

View File

@ -2,12 +2,18 @@
<!-- 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="name"/>
<field name="housekeeping"/>
<field name="state"/>
<field name="cleaning_type"/>
<button name="clean" string="Clean"/>
<button name="dirty" string="Dirty"/>
<button name="inspected" string="Inspected"/>
<button name="maintenance" string="Maintenance"/>
<field name="name" expand="1"/>
<field name="housekeeping" expand="1"/>
<field name="state" expand="1"/>
<field name="cleaning_type" expand="1"/>
<field name="last_clean" widget="date"/>
<field name="last_clean" widget="time" string="Time"/>
<field name="last_check_in" widget="date"/>
<field name="last_check_in" widget="time" string="Time"/>
<field name="last_check_out" widget="date"/>
<field name="last_check_out" widget="time" string="Time"/>
<button name="clean" string="Clean" expand="1"/>
<button name="dirty" string="Dirty" expand="1"/>
<button name="inspected" string="Inspected" expand="1"/>
<button name="maintenance" string="Maintenance" expand="1"/>
</tree>