Release v6.0

This commit is contained in:
wilson gomez 2021-07-21 07:56:53 -05:00
parent 252aa23f12
commit 8666ae4c53
16 changed files with 174 additions and 156 deletions

View File

@ -1,20 +1,20 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of # This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from trytond.pool import Pool from trytond.pool import Pool
import location from . import location
import configuration from . import configuration
import room from . import room
import booking from . import booking
import operation from . import operation
import housekeeping from . import housekeeping
import company from . import company
import city from . import city
import party from . import party
import channel from . import channel
import product from . import product
import sale from . import sale
import service from . import service
import policy from . import policy
def register(): def register():

View File

@ -10,15 +10,8 @@ from trytond.report import Report
from trytond.pyson import Eval, If, In, Get, Not, Or, Equal, Bool from trytond.pyson import Eval, If, In, Get, Not, Or, Equal, Bool
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.pool import Pool from trytond.pool import Pool
from trytond.model.exceptions import AccessError
from trytond.i18n import gettext
__all__ = [
'Booking', 'BookingLine', 'BookingReport', 'SelectRooms', 'SelectRoomsAsk',
'BookingVoucher', 'RoomsOccupancy', 'RoomsOccupancyStart',
'RoomsOccupancyReport', 'GuestsListReport', 'GuestsListStart',
'RegistrationCardReport', 'BookingForecastReport', 'GuestsList',
'Guest', 'BookingDailyStart', 'BookingDaily', 'BookingDailyReport'
]
STATE = [ STATE = [
(None, ''), (None, ''),
@ -283,19 +276,6 @@ class Booking(Workflow, ModelSQL, ModelView):
'invisible': Eval('state') != 'confirmed' 'invisible': Eval('state') != 'confirmed'
}, },
}) })
cls._error_messages.update({
'invalid_number_principal_guest': ('Must exist one principal guest'),
'payterm_missing': ('The payment term is missing!'),
'check_time_not_configured': ('The check out time is not configured!'),
'invalid_arrival_date': ('You cannot check in before the reserved date!'),
'missing_main_guest': ('Missing main guest in lines!'),
'missing_select_room': ('Missing select room!'),
'missing_default_configuration': ('Missing default configuration sequence!'),
'payterm_missing': ('The payment term is missing!'),
'room_no_clean': ('The room %s is not clean!'),
'missing_sequence_registration': ('Missing the configuration of \
registration card sequence!'),
})
@classmethod @classmethod
def trigger_create(cls, records): def trigger_create(cls, records):
@ -483,14 +463,13 @@ class Booking(Workflow, ModelSQL, ModelView):
Fill the number field with the booking sequence Fill the number field with the booking sequence
""" """
pool = Pool() pool = Pool()
Sequence = pool.get('ir.sequence')
Config = pool.get('hotel.configuration') Config = pool.get('hotel.configuration')
config = Config.get_configuration() config = Config.get_configuration()
for booking in bookings: for booking in bookings:
if booking.number or not config.booking_sequence: if booking.number or not config.booking_sequence:
continue continue
number = Sequence.get_id(config.booking_sequence.id) number = config.booking_sequence.get()
cls.write([booking], {'number': number}) cls.write([booking], {'number': number})
def cancel_occupancy(self): def cancel_occupancy(self):
@ -505,7 +484,6 @@ class Booking(Workflow, ModelSQL, ModelView):
Fill the number field for registration card with sequence Fill the number field for registration card with sequence
""" """
pool = Pool() pool = Pool()
Sequence = pool.get('ir.sequence')
Config = pool.get('hotel.configuration') Config = pool.get('hotel.configuration')
config = Config.get_configuration() config = Config.get_configuration()
@ -513,8 +491,8 @@ class Booking(Workflow, ModelSQL, ModelView):
if booking.registration_card: if booking.registration_card:
continue continue
if not config.registration_card_sequence: if not config.registration_card_sequence:
cls.raise_user_error('missing_sequence_registration') raise AccessError(gettext('hotel.msg_missing_sequence_registration'))
number = Sequence.get_id(config.registration_card_sequence.id) number = config.registration_card_sequence.get()
cls.write([booking], {'registration_card': number}) cls.write([booking], {'registration_card': number})
def delete_occupancy(self): def delete_occupancy(self):
@ -530,7 +508,7 @@ class Booking(Workflow, ModelSQL, ModelView):
config = Config.get_configuration() config = Config.get_configuration()
if config.check_out_time is None or config.check_in_time is None: if config.check_out_time is None or config.check_in_time is None:
self.raise_user_error('check_time_not_configured') raise AccessError(gettext('hotel.msg_check_time_not_configured'))
if self.invoice_method == 'by_booking': if self.invoice_method == 'by_booking':
to_create = [(self.party, l, l.product.id, l.unit_price) for l in self.lines] to_create = [(self.party, l, l.product.id, l.unit_price) for l in self.lines]
@ -558,7 +536,7 @@ class Booking(Workflow, ModelSQL, ModelView):
]) ])
for hk in housekeepings: for hk in housekeepings:
if hk.room.id in rooms_ids: if hk.room.id in rooms_ids:
self.raise_user_error('room_no_clean', hk.room.name) raise AccessError(gettext('hotel.msg_room_no_clean', s=hk.room.name))
def get_context_price(self, product): def get_context_price(self, product):
context = {} context = {}
@ -697,7 +675,7 @@ class Booking(Workflow, ModelSQL, ModelView):
self.get_message('El usuario no tiene un correo asociado.') self.get_message('El usuario no tiene un correo asociado.')
def get_message(self, message): def get_message(self, message):
self.raise_user_error(message) raise AccessError(gettext('hotel.msg_error', s=message))
class BookingLine(ModelSQL, ModelView): class BookingLine(ModelSQL, ModelView):
@ -755,17 +733,6 @@ class BookingLine(ModelSQL, ModelView):
'nationality', 'origin_country', 'target_country', 'nationality', 'origin_country', 'target_country',
'registration_state', 'guests' 'registration_state', 'guests'
], ],
cls._error_messages.update({
'invalid_number_guests': ('Invalid number of guests for '
'the room %s.'),
'accommodation_not_defined': ('The room %s has not accommodation'),
'invalid_date': ('Departure date must be greater \
that arrival date'),
'occupied_room': ('The room is occupied in the date %s'),
'restring_room': ('The room %s is in restring access for quarantine protocolo!'),
'missing_confirm_booking': ('Missing Confirm Booking'),
'reservation_checkin': ('The reservation already has check_in or check_out'),
})
cls._buttons.update({ cls._buttons.update({
'check_in': { 'check_in': {
'invisible': Eval('state') == 'confirmed' and 'invisible': Eval('state') == 'confirmed' and
@ -835,11 +802,11 @@ class BookingLine(ModelSQL, ModelView):
Booking.set_registration_card_number([record]) Booking.set_registration_card_number([record])
line = records[0] line = records[0]
if line.state == 'offer': if line.state == 'offer':
line.raise_user_error('missing_confirm_booking') raise AccessError(gettext('hotel.msg_missing_confirm_booking'))
if line.main_guest is None: if line.main_guest is None:
Booking.raise_user_error('missing_main_guest') raise AccessError(gettext('hotel.msg_missing_main_guest'))
if line.room is None: if line.room is None:
Booking.raise_user_error('missing_select_room') raise AccessError(gettext('hotel.msg_missing_select_room'))
record.check_rooms() record.check_rooms()
cls.write([records[0]], {'registration_state': 'check_in'}) cls.write([records[0]], {'registration_state': 'check_in'})
record.update_occupancy(state='open',records=records,check=check) record.update_occupancy(state='open',records=records,check=check)
@ -953,11 +920,11 @@ class BookingLine(ModelSQL, ModelView):
""" """
Date = Pool().get('ir.date') Date = Pool().get('ir.date')
if self.registration_state in (['check_in', 'check_out']): if self.registration_state in (['check_in', 'check_out']):
self.raise_user_error('reservation_checkin') raise AccessError(gettext('hotel.msg_reservation_checkin'))
if self.arrival_date < Date.today(): if self.arrival_date < Date.today():
self.raise_user_error('invalid_arrival_date') raise AccessError(gettext('hotel.msg_invalid_arrival_date'))
if self.arrival_date >= self.departure_date: if self.arrival_date >= self.departure_date:
self.raise_user_error('invalid_date') raise AccessError(gettext('hotel.msg_invalid_date'))
Operation = Pool().get('hotel.operation') Operation = Pool().get('hotel.operation')
operations = Operation.search([ operations = Operation.search([
('room', '=', self.room.id), ('room', '=', self.room.id),
@ -973,7 +940,7 @@ class BookingLine(ModelSQL, ModelView):
]) ])
print(operations) print(operations)
if operations: if operations:
self.raise_user_error('occupied_room', self.departure_date) raise AccessError(gettext('hotel.msg_occupied_room', s=self.departure_date))
config = Pool().get('hotel.configuration')(1) config = Pool().get('hotel.configuration')(1)
quarantine_days = config.quarantine_rooms quarantine_days = config.quarantine_rooms
room_id = self.room.id room_id = self.room.id
@ -992,7 +959,7 @@ class BookingLine(ModelSQL, ModelView):
]]]]) ]]]])
print(operations) print(operations)
if operations: if operations:
self.raise_user_error('restring_room', self.room.name) raise AccessError(gettext('hotel.msg_restring_room', s=self.room.name))
def get_state(self, name): def get_state(self, name):
if self.booking: if self.booking:
@ -1044,8 +1011,8 @@ class BookingReport(Report):
__name__ = 'hotel.booking' __name__ = 'hotel.booking'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(BookingReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
user = Pool().get('res.user')(Transaction().user) user = Pool().get('res.user')(Transaction().user)
report_context['company'] = user.company report_context['company'] = user.company
return report_context return report_context
@ -1378,8 +1345,8 @@ class BookingForecastReport(Report):
__name__ = 'hotel.booking_forecast.report' __name__ = 'hotel.booking_forecast.report'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(BookingForecastReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
MAX_DAYS = 30 MAX_DAYS = 30
pool = Pool() pool = Pool()
Company = pool.get('company.company') Company = pool.get('company.company')
@ -1444,8 +1411,8 @@ class RegistrationCardReport(Report):
__name__ = 'hotel.occupancy.registration_card' __name__ = 'hotel.occupancy.registration_card'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(RegistrationCardReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
user = Pool().get('res.user')(Transaction().user) user = Pool().get('res.user')(Transaction().user)
report_context['company'] = user.company report_context['company'] = user.company
return report_context return report_context
@ -1493,8 +1460,8 @@ class GuestsListReport(Report):
__name__ = 'hotel.guests_list.report' __name__ = 'hotel.guests_list.report'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(GuestsListReport, cls).get_context(records, 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') Operation = pool.get('hotel.operation')
@ -1574,8 +1541,8 @@ class RoomsOccupancyReport(Report):
__name__ = 'hotel.rooms_occupancy.report' __name__ = 'hotel.rooms_occupancy.report'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(RoomsOccupancyReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
pool = Pool() pool = Pool()
Company = pool.get('company.company') Company = pool.get('company.company')
Room = pool.get('hotel.room') Room = pool.get('hotel.room')
@ -1677,8 +1644,8 @@ class BookingDailyReport(Report):
__name__ = 'hotel.booking_daily.report' __name__ = 'hotel.booking_daily.report'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(BookingDailyReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
pool = Pool() pool = Pool()
Company = pool.get('company.company') Company = pool.get('company.company')
records = BookingLine.search([ records = BookingLine.search([

View File

@ -3,8 +3,6 @@
from trytond.model import fields from trytond.model import fields
from trytond.pool import PoolMeta from trytond.pool import PoolMeta
__all__ = ['Company']
class Company(metaclass=PoolMeta): class Company(metaclass=PoolMeta):
__name__ = 'company.company' __name__ = 'company.company'

View File

@ -3,8 +3,8 @@
from trytond.model import ModelView, ModelSQL, fields from trytond.model import ModelView, ModelSQL, fields
from trytond.pyson import Eval, If from trytond.pyson import Eval, If
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.model.exceptions import AccessError
__all__ = ['Configuration', 'ConfigurationProduct'] from trytond.i18n import gettext
class Configuration(ModelSQL, ModelView): class Configuration(ModelSQL, ModelView):
@ -61,9 +61,6 @@ class Configuration(ModelSQL, ModelView):
@classmethod @classmethod
def __setup__(cls): def __setup__(cls):
super(Configuration, cls).__setup__() super(Configuration, cls).__setup__()
cls._error_messages.update({
'missing_default_configuration': ('Missing default configuration sequence!'),
})
@staticmethod @staticmethod
def default_company(): def default_company():
@ -77,7 +74,7 @@ class Configuration(ModelSQL, ModelView):
('company', '=', company_id) ('company', '=', company_id)
]) ])
if not config or not config.booking_sequence: if not config or not config.booking_sequence:
cls.raise_user_error('missing_default_configuration') raise AccessError(gettext('hotel.missing_default_configuration'))
return config return config

9
exceptions.py Normal file
View File

@ -0,0 +1,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.
from trytond.exceptions import UserError, UserWarning
# from trytond.model.exceptions import ValidationError
class BadOperationError(UserError):
pass

View File

@ -8,12 +8,6 @@ from trytond.transaction import Transaction
from datetime import datetime from datetime import datetime
from trytond.pool import Pool from trytond.pool import Pool
__all__ = [
'Housekeeping', 'HotelTask', 'HotelHousekeepingTask',
'HousekeepingServiceReport', 'HousekeepingService',
'HousekeepingServiceStart', 'HousekeepingCleaningType'
]
STATES = {'invisible': (Eval('type') != 'service')} STATES = {'invisible': (Eval('type') != 'service')}
@ -231,8 +225,8 @@ class HousekeepingServiceReport(Report):
__name__ = 'hotel.print_housekeeping_service.report' __name__ = 'hotel.print_housekeeping_service.report'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(HousekeepingServiceReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
pool = Pool() pool = Pool()
Company = pool.get('company.company') Company = pool.get('company.company')
Housekeeping = pool.get('hotel.housekeeping') Housekeeping = pool.get('hotel.housekeeping')

View File

@ -2,8 +2,6 @@
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, fields from trytond.model import ModelView, ModelSQL, fields
__all__ = ['HotelLocation']
class HotelLocation(ModelSQL, ModelView): class HotelLocation(ModelSQL, ModelView):
"Hotel Location" "Hotel Location"

88
message.xml Normal file
View File

@ -0,0 +1,88 @@
<?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. -->
<tryton>
<data grouped="1">
<record model="ir.message" id="msg_sale_closed">
<field name="text">You can not add charges to a sale is closed %s</field>
</record>
<record model="ir.message" id="msg_room_not_occupied">
<field name="text">The room %s selected is not occupied</field>
</record>
<record model="ir.message" id="msg_invalid_number_principal_guest">
<field name="text">Must exist one principal guest</field>
</record>
<record model="ir.message" id="msg_payterm_missing">
<field name="text">The payment term is missing!</field>
</record>
<record model="ir.message" id="msg_check_time_not_configured">
<field name="text">The check out time is not configured!</field>
</record>
<record model="ir.message" id="msg_invalid_arrival_date">
<field name="text">You cannot check in before the reserved date!</field>
</record>
<record model="ir.message" id="msg_missing_main_guest">
<field name="text">Missing main guest in lines!</field>
</record>
<record model="ir.message" id="msg_missing_select_room">
<field name="text">Missing select room!</field>
</record>
<record model="ir.message" id="msg_missing_default_configuration">
<field name="text">Missing default configuration sequence!</field>
</record>
<record model="ir.message" id="msg_payterm_missing">
<field name="text">The payment term is missing!</field>
</record>
<record model="ir.message" id="msg_room_no_clean">
<field name="text">The room %s is not clean!</field>
</record>
<record model="ir.message" id="msg_missing_sequence_registration">
<field name="text">Missing the configuration of registration card sequence!</field>
</record>
<record model="ir.message" id="msg_invalid_number_guests">
<field name="text">Invalid number of guests for the room %s.</field>
</record>
<record model="ir.message" id="msg_accommodation_not_defined">
<field name="text">The room %s has not accommodation</field>
</record>
<record model="ir.message" id="msg_invalid_date">
<field name="text">Departure date must be greater that arrival date</field>
</record>
<record model="ir.message" id="msg_occupied_room">
<field name="text">The room is occupied in the date %s</field>
</record>
<record model="ir.message" id="msg_restring_room">
<field name="text">The room %s is in restring access for quarantine protocolo!</field>
</record>
<record model="ir.message" id="msg_missing_confirm_booking">
<field name="text">Missing Confirm Booking</field>
</record>
<record model="ir.message" id="msg_reservation_checkin">
<field name="text">The reservation already has check_in or check_out</field>
</record>
<record model="ir.message" id="msg_error">
<field name="text">Error "\n" %s</field>
</record>
<record model="ir.message" id="msg_missing_default_configuration">
<field name="text">Missing default configuration sequence!</field>
</record>
<record model="ir.message" id="msg_overlap_operation_line">
<field name="text">The operation for the room %s</field>
</record>
<record model="ir.message" id="msg_overlap_operation_line">
<field name="text">The operation for the room %s overlaps with another operation!</field>
</record>
<record model="ir.message" id="msg_invalid_date_range">
<field name="text">The start date is greater than end date</field>
</record>
<record model="ir.message" id="msg_missing_default_configuration">
<field name="text">Missing default configuration for check-in time or check-out time!</field>
</record>
<record model="ir.message" id="msg_occupied_room">
<field name="text">The room is occupied %s</field>
</record>
<record model="ir.message" id="msg_operation_current">
<field name="text">Error, Can not select current operation</field>
</record>
</data>
</tryton>

View File

@ -9,16 +9,8 @@ from trytond.pool import Pool
from trytond.report import Report from trytond.report import Report
from trytond.wizard import Wizard, StateView, StateAction, Button, StateTransition from trytond.wizard import Wizard, StateView, StateAction, Button, StateTransition
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.model.exceptions import AccessError
__all__ = [ from trytond.i18n import gettext
'Operation', 'OperationLine', 'OperationMaintenance', 'Migration',
'OpenMigration', 'OpenMigrationStart', 'OperationGuest', 'OperationReport',
'CheckOutOperation', 'CheckOutOperationFailed', 'ChangeRoomStart',
'ChangeRoom', 'TransferOperationStart', 'TransferOperation',
'TransferChargeStart', 'TransferCharge', 'OperationByConsumerReport',
'OperationBill', 'OperationVoucher', 'StatisticsByMonthStart',
'StatisticsByMonth', 'StatisticsByMonthReport'
]
STATES_OP = { STATES_OP = {
'readonly': Eval('state').in_(['check_out', 'done', 'cancelled']) 'readonly': Eval('state').in_(['check_out', 'done', 'cancelled'])
@ -140,14 +132,6 @@ class Operation(Workflow, ModelSQL, ModelView):
@classmethod @classmethod
def __setup__(cls): def __setup__(cls):
super(Operation, cls).__setup__() super(Operation, cls).__setup__()
cls._error_messages.update({
'overlap_operation_line': ('The operation for the room %s '
'overlaps with another operation!'),
'invalid_date_range': ('The start date is greater than end date'),
'missing_default_configuration': ('Missing default configuration for check-in '
'time or check-out time!'),
'occupied_room': ('The room is occupied %s')
})
cls._transitions |= set(( cls._transitions |= set((
('draft', 'open'), ('draft', 'open'),
('draft', 'cancelled'), ('draft', 'cancelled'),
@ -195,7 +179,7 @@ class Operation(Workflow, ModelSQL, ModelView):
] ]
]]]) ]]])
if operations: if operations:
cls.raise_user_error('occupied_room', r.room.name) raise AccessError(gettext('hotel.msg_occupied_room', s=r.room.name))
@classmethod @classmethod
def occupancy_rate(cls, start, end): def occupancy_rate(cls, start, end):
@ -367,7 +351,7 @@ class Operation(Workflow, ModelSQL, ModelView):
config = Configuration.get_configuration() config = Configuration.get_configuration()
if not config.cleaning_check_in or not config.cleaning_check_out \ if not config.cleaning_check_in or not config.cleaning_check_out \
or not config.cleaning_occupied: or not config.cleaning_occupied:
self.raise_user_error('missing_cleaning_configuration') raise AccessError(gettext('hotel.msg_missing_cleaning_configuration'))
if state == 'check_in': if state == 'check_in':
values = { values = {
'availability': 'occupied', 'availability': 'occupied',
@ -384,7 +368,7 @@ class Operation(Workflow, ModelSQL, ModelView):
('room', '=', self.room.id) ('room', '=', self.room.id)
]) ])
if not housekeepings: if not housekeepings:
self.raise_user_error('missing_configuration_housekeeping_rooms') raise AccessError(gettext('hotel.msg_missing_configuration_housekeeping_rooms'))
Housekeeping.write(housekeepings, values) Housekeeping.write(housekeepings, values)
# def get_sale(self, name=None): # def get_sale(self, name=None):
@ -491,7 +475,7 @@ class Operation(Workflow, ModelSQL, ModelView):
""" """
if start_date >= end_date: if start_date >= end_date:
cls.raise_user_error('invalid_date_range') raise AccessError(gettext('hotel.msg_invalid_date_range'))
# define the domain of the operations that find a # define the domain of the operations that find a
# room to be available # room to be available
@ -529,7 +513,7 @@ class Operation(Workflow, ModelSQL, ModelView):
start_date, end_date, rooms_ids, operation start_date, end_date, rooms_ids, operation
) )
if room.id not in available_rooms: if room.id not in available_rooms:
cls.raise_user_error('overlap_operation_line', (room.name,)) raise AccessError(gettext('hotel.overlap_operation_line', s=room.name))
def get_nights_quantity(self, name=None): def get_nights_quantity(self, name=None):
""" """
@ -1051,8 +1035,8 @@ class Migration(Report):
__name__ = 'hotel.migration' __name__ = 'hotel.migration'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(Migration, cls).get_context(records, data) report_context = super().get_context(records, header, data)
Line = Pool().get('hotel.booking.line') Line = Pool().get('hotel.booking.line')
start = data['start_date'] start = data['start_date']
end = data['end_date'] end = data['end_date']
@ -1067,8 +1051,8 @@ class OperationReport(Report):
__name__ = 'hotel.operation' __name__ = 'hotel.operation'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(OperationReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
user = Pool().get('res.user')(Transaction().user) user = Pool().get('res.user')(Transaction().user)
report_context['company'] = user.company report_context['company'] = user.company
return report_context return report_context
@ -1237,9 +1221,6 @@ class TransferOperation(Wizard):
@classmethod @classmethod
def __setup__(cls): def __setup__(cls):
super(TransferOperation, cls).__setup__() super(TransferOperation, cls).__setup__()
cls._error_messages.update({
'operation_current': ('Error, Can not select current operation'),
})
def transition_transfer(self): def transition_transfer(self):
pool = Pool() pool = Pool()
@ -1248,7 +1229,7 @@ class TransferOperation(Wizard):
current_op = Operation(Transaction().context.get('active_id')) current_op = Operation(Transaction().context.get('active_id'))
target_op = self.start.operation target_op = self.start.operation
if target_op.id == current_op.id: if target_op.id == current_op.id:
self.raise_user_error('operation_current') raise AccessError(gettext('hotel.msg_operation_current'))
lines_to_transfer = [] lines_to_transfer = []
if self.start.tranfer_charges: if self.start.tranfer_charges:
@ -1303,8 +1284,8 @@ class OperationByConsumerReport(Report):
__name__ = 'hotel.operation.line' __name__ = 'hotel.operation.line'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(OperationByConsumerReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
pool = Pool() pool = Pool()
Operation = pool.get('hotel.operation') Operation = pool.get('hotel.operation')
user = pool.get('res.user')(Transaction().user) user = pool.get('res.user')(Transaction().user)
@ -1395,8 +1376,8 @@ class StatisticsByMonthReport(Report):
__name__ = 'hotel.statistics_by_month.report' __name__ = 'hotel.statistics_by_month.report'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(StatisticsByMonthReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
Operation = Pool().get('hotel.operation') Operation = Pool().get('hotel.operation')
Period = Pool().get('account.period') Period = Pool().get('account.period')
Company = Pool().get('company.company') Company = Pool().get('company.company')

View File

@ -3,12 +3,10 @@
#and license terms. #and license terms.
from trytond.pool import PoolMeta, Pool from trytond.pool import PoolMeta, Pool
from trytond.model import fields, ModelView from trytond.model import fields, ModelView
from trytond.wizard import Wizard, StateView, Button, StateTransition, StateReport from trytond.wizard import Wizard, StateView, Button, StateTransition
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.model.exceptions import AccessError
from trytond.i18n import gettext
__all__ = ['Party', 'CreateGuest', 'CreateGuestStart']
TYPE = [ TYPE = [
('', ''), ('', ''),
@ -169,4 +167,4 @@ class CreateGuest(Wizard):
return 'end' return 'end'
def get_message(self, message): def get_message(self, message):
self.raise_user_error(message) raise AccessError(gettext('hotel.msg_error', s=message))

View File

@ -2,8 +2,6 @@
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, fields from trytond.model import ModelView, ModelSQL, fields
__all__ = ['HotelPolicyCancellation']
class HotelPolicyCancellation(ModelSQL, ModelView): class HotelPolicyCancellation(ModelSQL, ModelView):
'Hotel Policy Cancellation' 'Hotel Policy Cancellation'

View File

@ -5,8 +5,6 @@ from trytond.model import fields
from trytond.pool import PoolMeta from trytond.pool import PoolMeta
from trytond.pyson import Eval from trytond.pyson import Eval
__all__ = ['Template']
KIND = [ KIND = [
('', ''), ('', ''),

View File

@ -3,7 +3,6 @@
from trytond.model import ModelView, ModelSQL, fields from trytond.model import ModelView, ModelSQL, fields
from trytond.pyson import Eval from trytond.pyson import Eval
__all__ = ['Room', 'Amenities', 'RoomClassification', 'RoomAmenities', 'RoomTemplate']
STATES = {'readonly': (Eval('state') != 'draft')} STATES = {'readonly': (Eval('state') != 'draft')}

11
sale.py
View File

@ -8,9 +8,6 @@ from trytond.report import Report
from trytond.model import ModelView, fields from trytond.model import ModelView, fields
from trytond.transaction import Transaction from trytond.transaction import Transaction
__all__ = ['InvoiceIncomeDaily', 'InvoiceIncomeDailyStart',
'InvoiceIncomeDailyReport', 'InvoiceSimplifiedReport']
_ZERO = Decimal(0) _ZERO = Decimal(0)
@ -61,8 +58,8 @@ class InvoiceIncomeDailyReport(Report):
__name__ = 'hotel.invoice_income_daily_report' __name__ = 'hotel.invoice_income_daily_report'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(InvoiceIncomeDailyReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
pool = Pool() pool = Pool()
Invoice = pool.get('account.invoice') Invoice = pool.get('account.invoice')
Company = pool.get('company.company') Company = pool.get('company.company')
@ -197,8 +194,8 @@ class InvoiceSimplifiedReport(Report):
__name__ = 'account.invoice_simplified' __name__ = 'account.invoice_simplified'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(InvoiceSimplifiedReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
Company = Pool().get('company.company') Company = Pool().get('company.company')
categories = {} categories = {}

View File

@ -7,9 +7,8 @@ from trytond.pyson import Eval
from trytond.modules.company import CompanyReport from trytond.modules.company import CompanyReport
from trytond.wizard import Wizard, StateView, Button, StateTransition from trytond.wizard import Wizard, StateView, Button, StateTransition
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.model.exceptions import AccessError
__all__ = ['Service', 'ServiceLine', 'ServiceReport', 'ServiceKind', from trytond.i18n import gettext
'CreateDailyServices', 'CreateDailyServicesStart']
STATES = { STATES = {
'readonly': Eval('state') == 'checked' 'readonly': Eval('state') == 'checked'
@ -18,6 +17,7 @@ STATES_LINE = {
'readonly': Eval('state') == 'loaded' 'readonly': Eval('state') == 'loaded'
} }
class ServiceKind(ModelSQL, ModelView): class ServiceKind(ModelSQL, ModelView):
'Service Kind' 'Service Kind'
__name__ = 'hotel.service.kind' __name__ = 'hotel.service.kind'
@ -184,10 +184,6 @@ class ServiceLine(Workflow, ModelSQL, ModelView):
'invisible': Eval('state') != 'draft', 'invisible': Eval('state') != 'draft',
}, },
}) })
cls._error_messages.update({
'sale_closed': ('You can not add charges to a sale is closed %s'),
'room_not_occupied': ('The room %s selected is not occupied'),
})
@staticmethod @staticmethod
def default_quantity(): def default_quantity():
@ -288,8 +284,8 @@ class ServiceReport(CompanyReport):
__name__ = 'hotel.service' __name__ = 'hotel.service'
@classmethod @classmethod
def get_context(cls, records, data): def get_context(cls, records, header, data):
report_context = super(ServiceReport, cls).get_context(records, data) report_context = super().get_context(records, header, data)
return report_context return report_context

View File

@ -1,5 +1,5 @@
[tryton] [tryton]
version=5.0.4 version=6.0.0
depends: depends:
party party
company company