diff --git a/INSTALL b/INSTALL index 66aeccf..9088436 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Installing trytond_hotel Prerequisites ------------- - * Python 2.7 or later (http://www.python.org/) + * Python 3.10 or later (http://www.python.org/) * trytond (http://www.tryton.org/) * trytond_company (http://www.tryton.org/) * trytond_party (http://www.tryton.org/) diff --git a/booking.xml b/booking.xml index b2fcb4a..4f84161 100644 --- a/booking.xml +++ b/booking.xml @@ -15,17 +15,6 @@ this repository contains the full copyright notices and license terms. --> view_select_rooms - - hotel.folio.guest - tree - guest_tree - - - hotel.folio.guest - form - guest_form - - Booking hotel.booking diff --git a/configuration.py b/configuration.py index 6bd9aef..9d35498 100644 --- a/configuration.py +++ b/configuration.py @@ -10,16 +10,16 @@ from trytond.i18n import gettext class Configuration(ModelSQL, ModelView): 'Hotel Configuration' __name__ = 'hotel.configuration' - booking_sequence = fields.Many2One('ir.sequence', - 'Hotel Booking Sequence', domain=[ + booking_sequence = fields.Many2One('ir.sequence', 'Hotel Booking Sequence', + domain=[ ('company', 'in', [Eval('context', {}).get('company', 0), None]), ('sequence_type', '=', Id('hotel', 'sequence_type_hotel')), ], required=True) - hotel_service_sequence = fields.Many2One('ir.sequence', - 'Hotel Service Sequence', domain=[ + hotel_service_sequence = fields.Many2One('ir.sequence', 'Service Sequence', + domain=[ ('company', 'in', [Eval('context', {}).get('company', 0), None]), ('sequence_type', '=', @@ -38,7 +38,8 @@ class Configuration(ModelSQL, ModelView): 'configuration', 'product', 'Default Charges') check_in_time = fields.Time('Check In Time', required=True) check_out_time = fields.Time('Check Out Time', required=True) - taxes_exception_rule = fields.Many2One('account.tax.rule', 'Taxes Exception Rule') + taxes_exception_rule = fields.Many2One('account.tax.rule', + 'Taxes Exception Rule') default_channel_seller = fields.Many2One('hotel.channel', 'Default Channel') company = fields.Many2One('company.company', 'Company', required=True, domain=[ @@ -58,7 +59,8 @@ class Configuration(ModelSQL, ModelView): 'Cleaning Check In') cleaning_occupied = fields.Many2One('hotel.room.cleaning_type', 'Cleaning Occupied') - quarantine_rooms = fields.Numeric('Quarantine Rooms', digits=(2, 0), help='In days') + quarantine_rooms = fields.Numeric('Quarantine Rooms', digits=(2, 0), + help='In days') booking_email = fields.Many2One('email.template', 'Booking Email') check_in_email = fields.Many2One('email.template', 'Check-In Email') customer_experience_email = fields.Many2One('email.template', @@ -84,7 +86,8 @@ class Configuration(ModelSQL, ModelView): ('company', '=', company_id) ]) if not config or not config.booking_sequence: - raise AccessError(gettext('hotel.missing_default_configuration')) + raise AccessError( + gettext('hotel.missing_default_configuration')) return config @@ -93,15 +96,15 @@ class ConfigurationProduct(ModelSQL): __name__ = 'hotel.configuration-product.product' _table = 'hotel_configuration_product_rel' configuration = fields.Many2One('hotel.configuration', 'Configuration', - ondelete='CASCADE', select=True, required=True) + ondelete='CASCADE', select=True, required=True) product = fields.Many2One('product.product', 'Product', - ondelete='RESTRICT', select=True, required=True) + ondelete='RESTRICT', select=True, required=True) class ChildrenPolicy(ModelSQL, ModelView): 'Children Policy' __name__ = 'hotel.children_policy' configuration = fields.Many2One('hotel.configuration', 'Configuration', - ondelete='CASCADE', select=True, required=True) + ondelete='CASCADE', required=True) limit_age = fields.Integer('Limit Age', help='In years') amount = fields.Numeric('Amount') diff --git a/folio.py b/folio.py index 3893aa2..d9d5a3b 100644 --- a/folio.py +++ b/folio.py @@ -56,7 +56,7 @@ class Folio(ModelSQL, ModelView): registration_card = fields.Char('Registration Card', readonly=True, select=True, help="Unique sequence for card guest registration.") room = fields.Many2One('hotel.room', 'Room', select=True, - states=STATES_CHECKIN) + states=STATES_CHECKOUT) arrival_date = fields.Date('Arrival Date', required=True, states=STATES_CHECKOUT) departure_date = fields.Date('Departure Date', required=True, @@ -84,8 +84,10 @@ 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) + estimated_arrival_time = fields.Time('Estimated Arrival Time', states={ + 'readonly': Eval('registration_state').in_( + ['check_out', 'no_show', 'cancelled'] + )}) unit_digits = fields.Function(fields.Integer('Unit Digits'), 'get_unit_digits') notes = fields.Text('Notes') total_amount = fields.Function(fields.Numeric('Total Amount', @@ -313,21 +315,23 @@ class Folio(ModelSQL, ModelView): bk = self.booking def _check_accommodation(folio): - if folio.payment_status == 'pending': + if folio.payment_status != 'paid': raise UserError(gettext('hotel.msg_accommodation_not_paid')) def _check_charges(folio): for charge in folio.charges: - if charge.status == 'pending': + if charge.status != 'paid': raise UserError(gettext('hotel.msg_charges_not_paid')) - break if bk.responsible_payment == 'guest': _check_charges(self) _check_accommodation(self) elif bk.responsible_payment == 'holder': + print('yeaaaaaa') if self.main_guest == bk.party: + print('yeaaaaaa1') for folio in bk.lines: + print('yeaaaaaa2') _check_charges(folio) _check_accommodation(folio) else: diff --git a/folio.xml b/folio.xml index 4a9fa0c..6fd18ed 100644 --- a/folio.xml +++ b/folio.xml @@ -141,33 +141,6 @@ 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 - - - - - - - - - - - - - diff --git a/guest.xml b/guest.xml index 2d6b59f..065c324 100644 --- a/guest.xml +++ b/guest.xml @@ -4,6 +4,44 @@ this repository contains the full copyright notices and license terms. --> + + hotel.folio.guest + tree + guest_tree + + + hotel.folio.guest + form + guest_form + + + + hotel.folio.guest + tree + board_folio_guest_tree + + + hotel.folio.guest + form + board_folio_guest_form + + + Guests + hotel.folio.guest + + + + + + + + + + + + + hotel.tag tree diff --git a/message.xml b/message.xml index 10ffc35..f315cbb 100644 --- a/message.xml +++ b/message.xml @@ -93,11 +93,11 @@ this repository contains the full copyright notices and license terms. --> The accommodation isn't paid! - - There is charges without payment!" - + - It can not check-in of future dates! "%(product)s" + It can not check-in of future dates!" diff --git a/migration.sql b/migration.sql deleted file mode 100644 index 85a301e..0000000 --- a/migration.sql +++ /dev/null @@ -1,54 +0,0 @@ - -DROP TABLE hotel_service_line CASCADE; -DROP TABLE hotel_service CASCADE; -DROP TABLE hotel_operation_maintenance CASCADE; - -ALTER TABLE hotel_booking_line RENAME TO hotel_folio; -trytond-admin -c .trytond/trytond.conf -v -d TAYLOR -u account - -UPDATE hotel_folio - SET registration_card=b.registration_card - FROM hotel_booking AS b - WHERE hotel_folio.booking=b.id; - -INSERT INTO booking_vouchers_rel (voucher, booking) - SELECT ov.voucher, hf.booking FROM operation_vouchers_rel AS ov - JOIN hotel_folio AS hf - ON hf.operation = ov.operation - WHERE ov.voucher NOT IN (SELECT voucher FROM booking_vouchers_rel); - -DROP TABLE hotel_folio_guest; -ALTER TABLE hotel_booking_guest RENAME TO hotel_folio_guest; -ALTER TABLE hotel_folio_guest RENAME COLUMN folio TO folio_old; -ALTER TABLE hotel_folio_guest RENAME COLUMN booking_line TO folio; - - -INSERT INTO hotel_folio_guest ( - birthday, doc_number, email, first_family_name, first_name, - folio, mobile, name, nationality, origin_country, party, - second_family_name, second_name, sex, target_country, type_document, - type_guest, type_person - ) - SELECT - birthday, doc_number, email, first_family_name, first_name, - folio, mobile, name, nationality, origin_country, party, - second_family_name, second_name, sex, target_country, type_document, - type_guest, type_person - FROM dup_hotel_folio_guest WHERE id IN (3, 4, 5); - - --- INSERT INTO hotel_folio_guest (folio, party) --- SELECT fo.id AS folio, og.party AS party --- FROM hotel_operation_guest AS og --- JOIN hotel_folio AS fo ON fo.operation = og.operation --- WHERE og.party NOT IN (SELECT party FROM hotel_folio_guest) --- GROUP BY og.party, fo.id ORDER BY fo.id; - - --- ALTER TABLE hotel_operation_guest RENAME TO hotel_folio; --- DROP TABLE operation_vouchers_rel; --- DROP TABLE hotel_folio_charge CASCADE; --- DROP TABLE hotel_folio CASCADE; --- DROP TABLE hotel_operation_guest CASCADE; --- DROP TABLE hotel_operation CASCADE; --- DROP TABLE hotel_operation_line CASCADE; diff --git a/view/booking_form.xml b/view/booking_form.xml index 2133f6d..a2b9c44 100644 --- a/view/booking_form.xml +++ b/view/booking_form.xml @@ -28,12 +28,12 @@ this repository contains the full copyright notices and license terms. -->