Fix
This commit is contained in:
parent
e30c38f8fe
commit
bbb8925a09
36
booking.py
36
booking.py
|
@ -194,7 +194,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
},
|
},
|
||||||
'bill_to_channel': {
|
'bill_to_channel': {
|
||||||
'invisible': ~Eval('channel'),
|
'invisible': ~Eval('channel'),
|
||||||
'readonly': Eval('channel_paymode') != 'ota_collect',
|
'readonly': (Eval('channel_paymode') != 'ota_collect') | Eval('channel_invoice', True),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -212,6 +212,22 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
default['booking_date'] = datetime.now()
|
default['booking_date'] = datetime.now()
|
||||||
return super(Booking, cls).copy(bookings, default=default)
|
return super(Booking, cls).copy(bookings, default=default)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def search_rec_name(cls, name, clause):
|
||||||
|
_, operator, value = clause
|
||||||
|
if operator.startswith('!') or operator.startswith('not '):
|
||||||
|
bool_op = 'AND'
|
||||||
|
else:
|
||||||
|
bool_op = 'OR'
|
||||||
|
domain = [
|
||||||
|
bool_op,
|
||||||
|
('number', operator, value),
|
||||||
|
('ota_booking_code', operator, value),
|
||||||
|
('party.name', operator, value),
|
||||||
|
('contact', operator, value),
|
||||||
|
]
|
||||||
|
return domain
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_currency():
|
def default_currency():
|
||||||
Company = Pool().get('company.company')
|
Company = Pool().get('company.company')
|
||||||
|
@ -249,6 +265,12 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
res += line.num_children
|
res += line.num_children
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@fields.depends('ota_booking_code', 'lines')
|
||||||
|
def on_change_ota_booking_code(self):
|
||||||
|
if self.ota_booking_code:
|
||||||
|
for line in self.lines:
|
||||||
|
line.reference = self.ota_booking_code
|
||||||
|
|
||||||
@fields.depends('party', 'price_list', 'lines')
|
@fields.depends('party', 'price_list', 'lines')
|
||||||
def on_change_party(self):
|
def on_change_party(self):
|
||||||
if self.party:
|
if self.party:
|
||||||
|
@ -422,7 +444,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
raise UserError(gettext('hotel.msg_customer_is_required'))
|
raise UserError(gettext('hotel.msg_customer_is_required'))
|
||||||
|
|
||||||
bk = fo.booking
|
bk = fo.booking
|
||||||
print(' fo.booking ....', fo.booking)
|
|
||||||
agent_id = bk.channel.agent.id if bk.channel else None
|
agent_id = bk.channel.agent.id if bk.channel else None
|
||||||
if party.id not in res.keys():
|
if party.id not in res.keys():
|
||||||
# Add room product to sale
|
# Add room product to sale
|
||||||
|
@ -481,8 +502,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
'reference': charge.folio.registration_card,
|
'reference': charge.folio.registration_card,
|
||||||
'lines': [],
|
'lines': [],
|
||||||
}
|
}
|
||||||
# if invoice_party_id != bk.party.id:
|
|
||||||
# else:
|
|
||||||
|
|
||||||
res[invoice_party_id]['lines'].append({
|
res[invoice_party_id]['lines'].append({
|
||||||
'description': ' | '.join([
|
'description': ' | '.join([
|
||||||
|
@ -817,13 +836,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
res += line.total_amount
|
res += line.total_amount
|
||||||
return res
|
return res
|
||||||
|
|
||||||
# def get_occupancies(self, name):
|
|
||||||
# occupancies = set()
|
|
||||||
# for line in self.lines:
|
|
||||||
# if line.occupancy_line:
|
|
||||||
# occupancies.add(line.occupancy_line.id)
|
|
||||||
# return list(occupancies)
|
|
||||||
|
|
||||||
def get_channel_commission(self, name):
|
def get_channel_commission(self, name):
|
||||||
res = sum(line.commission_amount for line in self.lines if
|
res = sum(line.commission_amount for line in self.lines if
|
||||||
line.commission_amount)
|
line.commission_amount)
|
||||||
|
@ -978,6 +990,8 @@ class SelectRooms(Wizard):
|
||||||
values = {
|
values = {
|
||||||
'booking': booking.id,
|
'booking': booking.id,
|
||||||
'product': product.id,
|
'product': product.id,
|
||||||
|
'reference': booking.ota_booking_code,
|
||||||
|
'contact': booking.contact,
|
||||||
'room': room.id,
|
'room': room.id,
|
||||||
'arrival_date': self.start.arrival_date,
|
'arrival_date': self.start.arrival_date,
|
||||||
'departure_date': self.start.departure_date,
|
'departure_date': self.start.departure_date,
|
||||||
|
|
30
folio.py
30
folio.py
|
@ -57,14 +57,17 @@ _ZERO = Decimal('0')
|
||||||
class Folio(ModelSQL, ModelView):
|
class Folio(ModelSQL, ModelView):
|
||||||
'Folio'
|
'Folio'
|
||||||
__name__ = 'hotel.folio'
|
__name__ = 'hotel.folio'
|
||||||
booking = fields.Many2One('hotel.booking', 'Booking', ondelete='CASCADE',
|
STATES = {
|
||||||
select=True)
|
|
||||||
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={
|
|
||||||
'required': Eval('registration_state') == 'check_in',
|
'required': Eval('registration_state') == 'check_in',
|
||||||
'readonly': Eval('registration_state') == 'check_in',
|
'readonly': Eval('registration_state') == 'check_in',
|
||||||
})
|
}
|
||||||
|
booking = fields.Many2One('hotel.booking', 'Booking', ondelete='CASCADE',
|
||||||
|
select=True)
|
||||||
|
reference = fields.Char('Reference', states=STATES)
|
||||||
|
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)
|
||||||
arrival_date = fields.Date('Arrival Date', required=True,
|
arrival_date = fields.Date('Arrival Date', required=True,
|
||||||
states=STATES_CHECKOUT)
|
states=STATES_CHECKOUT)
|
||||||
departure_date = fields.Date('Departure Date', required=True,
|
departure_date = fields.Date('Departure Date', required=True,
|
||||||
|
@ -83,10 +86,7 @@ class Folio(ModelSQL, ModelView):
|
||||||
'get_unit_price_w_tax')
|
'get_unit_price_w_tax')
|
||||||
uom = fields.Many2One('product.uom', 'UOM', readonly=True)
|
uom = fields.Many2One('product.uom', 'UOM', readonly=True)
|
||||||
main_guest = fields.Many2One('party.party', 'Main Guest', select=True,
|
main_guest = fields.Many2One('party.party', 'Main Guest', select=True,
|
||||||
states={
|
states=STATES_CHECKIN
|
||||||
'required': Eval('registration_state') == 'check_in',
|
|
||||||
'readonly': Eval('registration_state') == 'check_in',
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
contact = fields.Char('Contact', states=STATES_CHECKIN)
|
contact = fields.Char('Contact', states=STATES_CHECKIN)
|
||||||
num_children = fields.Function(fields.Integer('No. Children'),
|
num_children = fields.Function(fields.Integer('No. Children'),
|
||||||
|
@ -143,10 +143,11 @@ class Folio(ModelSQL, ModelView):
|
||||||
), 'on_change_with_room_amount')
|
), 'on_change_with_room_amount')
|
||||||
stock_moves = fields.Many2Many('hotel.folio-stock.move', 'folio',
|
stock_moves = fields.Many2Many('hotel.folio-stock.move', 'folio',
|
||||||
'move', 'Stock Moves', states={'readonly': True})
|
'move', 'Stock Moves', states={'readonly': True})
|
||||||
|
channel = fields.Function(fields.Many2One('hotel.channel', 'Channel'),
|
||||||
|
'get_channel')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
# UPDATE hotel_folio SET nights_quantity=(departure_date-arrival_date)
|
|
||||||
super(Folio, cls).__setup__()
|
super(Folio, cls).__setup__()
|
||||||
cls._check_modify_exclude = [
|
cls._check_modify_exclude = [
|
||||||
'nationality', 'origin_country', 'target_country',
|
'nationality', 'origin_country', 'target_country',
|
||||||
|
@ -190,6 +191,7 @@ class Folio(ModelSQL, ModelView):
|
||||||
('registration_card', operator, value),
|
('registration_card', operator, value),
|
||||||
('product.name', operator, value),
|
('product.name', operator, value),
|
||||||
('party.name', operator, value),
|
('party.name', operator, value),
|
||||||
|
('reference', operator, value),
|
||||||
]
|
]
|
||||||
return domain
|
return domain
|
||||||
|
|
||||||
|
@ -246,6 +248,10 @@ class Folio(ModelSQL, ModelView):
|
||||||
if self.invoice_line:
|
if self.invoice_line:
|
||||||
return self.invoice_line.invoice.state
|
return self.invoice_line.invoice.state
|
||||||
|
|
||||||
|
def get_channel(self, name=None):
|
||||||
|
if self.booking and self.booking.channel:
|
||||||
|
return self.booking.channel.id
|
||||||
|
|
||||||
def set_registration_number(self):
|
def set_registration_number(self):
|
||||||
"""
|
"""
|
||||||
Fill the number field for registration card with sequence
|
Fill the number field for registration card with sequence
|
||||||
|
@ -875,8 +881,8 @@ class Migration(Report):
|
||||||
('arrival_date', '>=', start),
|
('arrival_date', '>=', start),
|
||||||
('arrival_date', '<=', end),
|
('arrival_date', '<=', end),
|
||||||
('main_guest', '!=', None),
|
('main_guest', '!=', None),
|
||||||
('registration_state', 'in', ['check_in', 'check_out']),
|
|
||||||
('guests.party', '!=', None),
|
('guests.party', '!=', None),
|
||||||
|
('registration_state', 'in', ['check_in', 'check_out']),
|
||||||
])
|
])
|
||||||
return report_context
|
return report_context
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -2,3 +2,4 @@
|
||||||
ALTER TABLE hotel_channel DROP COLUMN commission;
|
ALTER TABLE hotel_channel DROP COLUMN commission;
|
||||||
ALTER TABLE hotel_channel DROP COLUMN payment_method;
|
ALTER TABLE hotel_channel DROP COLUMN payment_method;
|
||||||
ALTER TABLE hotel_booking RENAME COLUMN party_seller TO channel;
|
ALTER TABLE hotel_booking RENAME COLUMN party_seller TO channel;
|
||||||
|
UPDATE hotel_folio SET nights_quantity=(departure_date-arrival_date)
|
||||||
|
|
|
@ -28,6 +28,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="breakfast_included"/>
|
<field name="breakfast_included"/>
|
||||||
<label name="unit_price_w_tax"/>
|
<label name="unit_price_w_tax"/>
|
||||||
<field name="unit_price_w_tax"/>
|
<field name="unit_price_w_tax"/>
|
||||||
|
<label name="reference"/>
|
||||||
|
<field name="reference"/>
|
||||||
<notebook colspan="6">
|
<notebook colspan="6">
|
||||||
<page string="Charges" id="hotel_charges">
|
<page string="Charges" id="hotel_charges">
|
||||||
<field name="charges" colspan="4"/>
|
<field name="charges" colspan="4"/>
|
||||||
|
|
|
@ -7,10 +7,13 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="product" expand="1"/>
|
<field name="product" expand="1"/>
|
||||||
<field name="registration_card"/>
|
<field name="registration_card"/>
|
||||||
<field name="main_guest" expand="1"/>
|
<field name="main_guest" expand="1"/>
|
||||||
|
<field name="contact"/>
|
||||||
<field name="nights_quantity"/>
|
<field name="nights_quantity"/>
|
||||||
<field name="arrival_date"/>
|
<field name="arrival_date"/>
|
||||||
<field name="departure_date"/>
|
<field name="departure_date"/>
|
||||||
<field name="registration_state"/>
|
<field name="registration_state"/>
|
||||||
|
<field name="reference"/>
|
||||||
|
<field name="channel"/>
|
||||||
<field name="invoice_state"/>
|
<field name="invoice_state"/>
|
||||||
<field name="unit_price"/>
|
<field name="unit_price"/>
|
||||||
<field name="total_amount"/>
|
<field name="total_amount"/>
|
||||||
|
|
|
@ -30,6 +30,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="unit_price_w_tax"/>
|
<field name="unit_price_w_tax"/>
|
||||||
<label name="room_amount"/>
|
<label name="room_amount"/>
|
||||||
<field name="room_amount"/>
|
<field name="room_amount"/>
|
||||||
|
<label name="reference"/>
|
||||||
|
<field name="reference"/>
|
||||||
<notebook colspan="6">
|
<notebook colspan="6">
|
||||||
<page string="Charges" id="hotel_charges">
|
<page string="Charges" id="hotel_charges">
|
||||||
<field name="charges" colspan="4"/>
|
<field name="charges" colspan="4"/>
|
||||||
|
|
|
@ -20,10 +20,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="reason"/>
|
<field name="reason"/>
|
||||||
<label name="channel"/>
|
<label name="channel"/>
|
||||||
<field name="channel" widget="selection"/>
|
<field name="channel" widget="selection"/>
|
||||||
<label name="price_list"/>
|
|
||||||
<field name="price_list" widget="selection"/>
|
|
||||||
<label name="ota_booking_code"/>
|
<label name="ota_booking_code"/>
|
||||||
<field name="ota_booking_code"/>
|
<field name="ota_booking_code"/>
|
||||||
|
<label name="price_list"/>
|
||||||
|
<field name="price_list" widget="selection"/>
|
||||||
<button name="select_rooms" string="Select Rooms"
|
<button name="select_rooms" string="Select Rooms"
|
||||||
icon="tryton-open" colspan="4"/>
|
icon="tryton-open" colspan="4"/>
|
||||||
<button name="do_pay" string="Do Pay" icon="tryton-open"/>
|
<button name="do_pay" string="Do Pay" icon="tryton-open"/>
|
||||||
|
|
|
@ -6,8 +6,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="party" expand="1"/>
|
<field name="party" expand="1"/>
|
||||||
<field name="contact" expand="1"/>
|
<field name="contact" expand="1"/>
|
||||||
<field name="booking_date" widget="date"/>
|
<field name="booking_date" widget="date"/>
|
||||||
<field name="price_list"/>
|
|
||||||
<field name="channel" expand="1"/>
|
<field name="channel" expand="1"/>
|
||||||
|
<field name="ota_booking_code"/>
|
||||||
<field name="media"/>
|
<field name="media"/>
|
||||||
<field name="total_amount"/>
|
<field name="total_amount"/>
|
||||||
<field name="total_advance"/>
|
<field name="total_advance"/>
|
||||||
|
|
Loading…
Reference in New Issue