Compare commits
2 Commits
b619e84704
...
55a92733df
Author | SHA1 | Date |
---|---|---|
oscar alvarez | 55a92733df | |
oscar alvarez | 97566baf06 |
41
booking.py
41
booking.py
|
@ -1370,13 +1370,21 @@ class SelectRoomsAsk(ModelView):
|
||||||
})
|
})
|
||||||
unit_price_w_tax = fields.Numeric('Unit Price w Tax',
|
unit_price_w_tax = fields.Numeric('Unit Price w Tax',
|
||||||
digits=(16, 2), required=True)
|
digits=(16, 2), required=True)
|
||||||
|
price_list = fields.Many2One('product.price_list', 'Price List',
|
||||||
|
states={'readonly': True})
|
||||||
|
nights = fields.Integer('Nights', states={'readonly': True})
|
||||||
|
|
||||||
|
@fields.depends('arrival_date', 'departure_date')
|
||||||
|
def on_change_with_nights(self):
|
||||||
|
if self.departure_date and self.arrival_date:
|
||||||
|
return (self.departure_date - self.arrival_date).days
|
||||||
|
|
||||||
def _get_unit_price(self, booking):
|
def _get_unit_price(self, booking):
|
||||||
ctx = {}
|
ctx = {}
|
||||||
rate_plan = booking.rate_plan
|
# rate_plan = booking.rate_plan
|
||||||
unit_price = 0
|
unit_price = 0
|
||||||
if rate_plan:
|
if self.price_list:
|
||||||
ctx['price_list'] = rate_plan.price_list
|
ctx['price_list'] = self.price_list
|
||||||
ctx['sale_date'] = self.arrival_date
|
ctx['sale_date'] = self.arrival_date
|
||||||
ctx['currency'] = booking.currency.id
|
ctx['currency'] = booking.currency.id
|
||||||
if booking.party:
|
if booking.party:
|
||||||
|
@ -1385,15 +1393,32 @@ class SelectRoomsAsk(ModelView):
|
||||||
product = self.accommodation
|
product = self.accommodation
|
||||||
unit_price = product.template.list_price
|
unit_price = product.template.list_price
|
||||||
quantity = (self.departure_date - self.arrival_date).days
|
quantity = (self.departure_date - self.arrival_date).days
|
||||||
if rate_plan and rate_plan.price_list:
|
if self.price_list:
|
||||||
with Transaction().set_context(ctx):
|
with Transaction().set_context(ctx):
|
||||||
unit_price = rate_plan.price_list.compute(
|
unit_price = self.price_list.compute(
|
||||||
booking.party, product, unit_price,
|
booking.party, product, unit_price,
|
||||||
quantity, product.default_uom)
|
quantity, product.default_uom)
|
||||||
unit_price = booking.currency.round(unit_price)
|
unit_price = booking.currency.round(unit_price)
|
||||||
return unit_price
|
return unit_price
|
||||||
|
|
||||||
@fields.depends('accommodation', 'departure_date', 'arrival_date')
|
@fields.depends('arrival_date')
|
||||||
|
def on_change_with_price_list(self):
|
||||||
|
pool = Pool()
|
||||||
|
Booking = pool.get('hotel.booking')
|
||||||
|
RatePlan = pool.get('hotel.rate_plan')
|
||||||
|
booking = Booking(Transaction().context.get('active_id'))
|
||||||
|
rate_plan_id = booking.rate_plan.id if booking.rate_plan else None
|
||||||
|
args = {
|
||||||
|
'arrival_date': self.arrival_date,
|
||||||
|
'rate_plan_id': rate_plan_id,
|
||||||
|
}
|
||||||
|
price_list = RatePlan.best_price_list(args)
|
||||||
|
print('price_list....', price_list)
|
||||||
|
if price_list:
|
||||||
|
return price_list['id']
|
||||||
|
|
||||||
|
@fields.depends(
|
||||||
|
'accommodation', 'departure_date', 'arrival_date', 'price_list')
|
||||||
def on_change_with_unit_price_w_tax(self):
|
def on_change_with_unit_price_w_tax(self):
|
||||||
Booking = Pool().get('hotel.booking')
|
Booking = Pool().get('hotel.booking')
|
||||||
booking = Booking(Transaction().context.get('active_id'))
|
booking = Booking(Transaction().context.get('active_id'))
|
||||||
|
@ -1406,7 +1431,9 @@ class SelectRoomsAsk(ModelView):
|
||||||
res = sum(tx['base'] + tx['amount'] for tx in dict_taxes)
|
res = sum(tx['base'] + tx['amount'] for tx in dict_taxes)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@fields.depends('unit_price_w_tax', 'accommodation', 'departure_date', 'arrival_date')
|
@fields.depends(
|
||||||
|
'unit_price_w_tax', 'accommodation', 'departure_date', 'arrival_date',
|
||||||
|
'price_list')
|
||||||
def on_change_with_unit_price(self):
|
def on_change_with_unit_price(self):
|
||||||
Tax = Pool().get('account.tax')
|
Tax = Pool().get('account.tax')
|
||||||
Booking = Pool().get('hotel.booking')
|
Booking = Pool().get('hotel.booking')
|
||||||
|
|
2
folio.py
2
folio.py
|
@ -2521,7 +2521,7 @@ class GuestsListReport(Report):
|
||||||
|
|
||||||
guests = []
|
guests = []
|
||||||
for fo in folios:
|
for fo in folios:
|
||||||
for guest in op.guests:
|
for guest in fo.guests:
|
||||||
guests.append({
|
guests.append({
|
||||||
'room': fo.room.code,
|
'room': fo.room.code,
|
||||||
'guest': guest.name,
|
'guest': guest.name,
|
||||||
|
|
38
locale/es.po
38
locale/es.po
|
@ -328,7 +328,7 @@ msgstr "Plan Comercial"
|
||||||
|
|
||||||
msgctxt "field:hotel.booking,price_list:"
|
msgctxt "field:hotel.booking,price_list:"
|
||||||
msgid "Price List"
|
msgid "Price List"
|
||||||
msgstr "Lista de precios"
|
msgstr "Tarifa"
|
||||||
|
|
||||||
msgctxt "field:hotel.booking,rate_plan:"
|
msgctxt "field:hotel.booking,rate_plan:"
|
||||||
msgid "Rate Plan"
|
msgid "Rate Plan"
|
||||||
|
@ -434,10 +434,18 @@ msgctxt "field:hotel.booking.select_rooms.ask,departure_date:"
|
||||||
msgid "Departure Date"
|
msgid "Departure Date"
|
||||||
msgstr "Fecha de Salida"
|
msgstr "Fecha de Salida"
|
||||||
|
|
||||||
|
msgctxt "field:hotel.booking.select_rooms.ask,nights:"
|
||||||
|
msgid "Nights"
|
||||||
|
msgstr "Noches"
|
||||||
|
|
||||||
msgctxt "field:hotel.booking.select_rooms.ask,overbooking:"
|
msgctxt "field:hotel.booking.select_rooms.ask,overbooking:"
|
||||||
msgid "Overbooking"
|
msgid "Overbooking"
|
||||||
msgstr "Sobrereserva"
|
msgstr "Sobrereserva"
|
||||||
|
|
||||||
|
msgctxt "field:hotel.booking.select_rooms.ask,price_list:"
|
||||||
|
msgid "Price List"
|
||||||
|
msgstr "Tarifa"
|
||||||
|
|
||||||
msgctxt "field:hotel.booking.select_rooms.ask,rooms:"
|
msgctxt "field:hotel.booking.select_rooms.ask,rooms:"
|
||||||
msgid "Rooms"
|
msgid "Rooms"
|
||||||
msgstr "Habitaciones"
|
msgstr "Habitaciones"
|
||||||
|
@ -582,6 +590,10 @@ msgctxt "field:hotel.configuration,age_children_policy:"
|
||||||
msgid "Age Children Policy"
|
msgid "Age Children Policy"
|
||||||
msgstr "Pólitica de Niños"
|
msgstr "Pólitica de Niños"
|
||||||
|
|
||||||
|
msgctxt "field:hotel.configuration,auto_invoice:"
|
||||||
|
msgid "Auto Invoice"
|
||||||
|
msgstr "Auto Facturación"
|
||||||
|
|
||||||
msgctxt "field:hotel.configuration,booking_email:"
|
msgctxt "field:hotel.configuration,booking_email:"
|
||||||
msgid "Booking Email"
|
msgid "Booking Email"
|
||||||
msgstr "Email Reserva"
|
msgstr "Email Reserva"
|
||||||
|
@ -663,13 +675,17 @@ msgid "Offset Journal"
|
||||||
msgstr "Asiento de Cruze"
|
msgstr "Asiento de Cruze"
|
||||||
|
|
||||||
msgctxt "field:hotel.configuration,payment_term:"
|
msgctxt "field:hotel.configuration,payment_term:"
|
||||||
msgid "Payment Term"
|
msgid "Default Payment Term"
|
||||||
msgstr "Plazo de Pago"
|
msgstr "Plazo de Pago por Defecto"
|
||||||
|
|
||||||
msgctxt "field:hotel.configuration,payments_email:"
|
msgctxt "field:hotel.configuration,payments_email:"
|
||||||
msgid "Payments Email"
|
msgid "Payments Email"
|
||||||
msgstr "Pagos por Email"
|
msgstr "Pagos por Email"
|
||||||
|
|
||||||
|
msgctxt "field:hotel.configuration,price_list:"
|
||||||
|
msgid "Default Price List"
|
||||||
|
msgstr "Tarifa por Defecto"
|
||||||
|
|
||||||
msgctxt "field:hotel.configuration,quarantine_rooms:"
|
msgctxt "field:hotel.configuration,quarantine_rooms:"
|
||||||
msgid "Quarantine Rooms"
|
msgid "Quarantine Rooms"
|
||||||
msgstr "Cuarentena"
|
msgstr "Cuarentena"
|
||||||
|
@ -946,6 +962,10 @@ msgctxt "field:hotel.folio.charge,amount:"
|
||||||
msgid "Amount"
|
msgid "Amount"
|
||||||
msgstr "Valor"
|
msgstr "Valor"
|
||||||
|
|
||||||
|
msgctxt "field:hotel.folio.charge,amount_w_tax:"
|
||||||
|
msgid "Amount w Tax"
|
||||||
|
msgstr "Valor con Imp."
|
||||||
|
|
||||||
msgctxt "field:hotel.folio.charge,analytic_account:"
|
msgctxt "field:hotel.folio.charge,analytic_account:"
|
||||||
msgid "Analytic Account"
|
msgid "Analytic Account"
|
||||||
msgstr "Cuenta Analítica"
|
msgstr "Cuenta Analítica"
|
||||||
|
@ -1543,8 +1563,8 @@ msgid "Party"
|
||||||
msgstr "Tercero"
|
msgstr "Tercero"
|
||||||
|
|
||||||
msgctxt "field:hotel.rate_plan,price_list:"
|
msgctxt "field:hotel.rate_plan,price_list:"
|
||||||
msgid "Price List"
|
msgid "Default Price List"
|
||||||
msgstr "Tarifa"
|
msgstr "Tarifa por Defecto"
|
||||||
|
|
||||||
msgctxt "field:hotel.rate_plan,price_lists:"
|
msgctxt "field:hotel.rate_plan,price_lists:"
|
||||||
msgid "Price Lists"
|
msgid "Price Lists"
|
||||||
|
@ -2938,6 +2958,10 @@ msgid ""
|
||||||
"sequence!"
|
"sequence!"
|
||||||
msgstr "Falta la configuración de check-in o check-out"
|
msgstr "Falta la configuración de check-in o check-out"
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_missing_default_price_list"
|
||||||
|
msgid "Missing default price list!"
|
||||||
|
msgstr "Falta la lista de precios por defecto!"
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_missing_guest"
|
msgctxt "model:ir.message,text:msg_missing_guest"
|
||||||
msgid "It missing guest in booking \"%(number)s\"!"
|
msgid "It missing guest in booking \"%(number)s\"!"
|
||||||
msgstr "Falta el huesped en la reserva \"%(number)s\"!"
|
msgstr "Falta el huesped en la reserva \"%(number)s\"!"
|
||||||
|
@ -8873,6 +8897,10 @@ msgctxt "selection:hotel.configuration,accounting_revenue:"
|
||||||
msgid "Recognise Revenue"
|
msgid "Recognise Revenue"
|
||||||
msgstr "Reconocimiento de Ingresos"
|
msgstr "Reconocimiento de Ingresos"
|
||||||
|
|
||||||
|
msgctxt "selection:hotel.configuration,auto_invoice:"
|
||||||
|
msgid "Validate and Send"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgctxt "selection:hotel.configuration,full_clean_time:"
|
msgctxt "selection:hotel.configuration,full_clean_time:"
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|
43
rate_plan.py
43
rate_plan.py
|
@ -13,6 +13,7 @@ class RatePlanCalendar(ModelSQL, ModelView):
|
||||||
start_date = fields.Date('Start Date', required=True)
|
start_date = fields.Date('Start Date', required=True)
|
||||||
end_date = fields.Date('End Date', required=True)
|
end_date = fields.Date('End Date', required=True)
|
||||||
season = fields.Selection([
|
season = fields.Selection([
|
||||||
|
('', ''),
|
||||||
('high', 'High'),
|
('high', 'High'),
|
||||||
('low', 'Low'),
|
('low', 'Low'),
|
||||||
('middle', 'Middle'),
|
('middle', 'Middle'),
|
||||||
|
@ -66,7 +67,7 @@ class RatePlan(Workflow, ModelSQL, ModelView):
|
||||||
sunday = fields.Char('Sunday', help="Example, -15%")
|
sunday = fields.Char('Sunday', help="Example, -15%")
|
||||||
holiday = fields.Char('Holiday', help="Example, -15%")
|
holiday = fields.Char('Holiday', help="Example, -15%")
|
||||||
price_list = fields.Many2One('product.price_list', 'Default Price List',
|
price_list = fields.Many2One('product.price_list', 'Default Price List',
|
||||||
required=True)
|
required=False)
|
||||||
# Add children policy
|
# Add children policy
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -107,34 +108,30 @@ class RatePlan(Workflow, ModelSQL, ModelView):
|
||||||
Config = pool.get('hotel.configuration')
|
Config = pool.get('hotel.configuration')
|
||||||
rate_plan_id = args.get('rate_plan_id', None)
|
rate_plan_id = args.get('rate_plan_id', None)
|
||||||
arrival_date = args['arrival_date']
|
arrival_date = args['arrival_date']
|
||||||
|
season = 'middle'
|
||||||
|
rate_plan = None
|
||||||
calendars = Calendar.search([
|
calendars = Calendar.search([
|
||||||
('start_date', '>=', arrival_date),
|
('start_date', '<=', arrival_date),
|
||||||
('end_date', '<=', arrival_date),
|
('end_date', '>=', arrival_date),
|
||||||
])
|
])
|
||||||
|
print("calendars....", calendars)
|
||||||
|
|
||||||
if calendars:
|
if calendars:
|
||||||
season = calendars[0].season
|
season = calendars[0].season
|
||||||
else:
|
|
||||||
season = 'middle'
|
|
||||||
|
|
||||||
if rate_plan_id:
|
|
||||||
rate_plan = cls(rate_plan_id)
|
|
||||||
else:
|
|
||||||
return {}
|
|
||||||
|
|
||||||
price_list = None
|
price_list = None
|
||||||
for pl in rate_plan.price_lists:
|
config = Config.get_configuration()
|
||||||
if pl.season == season:
|
if rate_plan_id:
|
||||||
price_list = pl
|
rate_plan = cls(rate_plan_id)
|
||||||
break
|
for pl in rate_plan.price_lists:
|
||||||
|
if pl.season == season:
|
||||||
if not price_list:
|
price_list = pl
|
||||||
config = Config.get_configuration()
|
break
|
||||||
if config.price_list:
|
elif config.price_list:
|
||||||
price_list = config.price_list
|
price_list = config.price_list
|
||||||
else:
|
# else:
|
||||||
# This is in deprecation
|
# # This is in deprecation
|
||||||
price_list = rate_plan.price_list
|
# price_list = rate_plan.price_list
|
||||||
|
|
||||||
if not price_list:
|
if not price_list:
|
||||||
raise UserError(gettext('hotel.msg_missing_default_price_list'))
|
raise UserError(gettext('hotel.msg_missing_default_price_list'))
|
||||||
|
|
|
@ -12,10 +12,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="party"/>
|
<field name="party"/>
|
||||||
<label name="channel"/>
|
<label name="channel"/>
|
||||||
<field name="channel" widget="selection"/>
|
<field name="channel" widget="selection"/>
|
||||||
<label name="minimum_stay"/>
|
<group string="Stay Features" col="4" id="stay" colspan="2">
|
||||||
<field name="minimum_stay"/>
|
<label name="minimum_stay"/>
|
||||||
<label name="minimum_advance"/>
|
<field name="minimum_stay"/>
|
||||||
<field name="minimum_advance"/>
|
<label name="minimum_advance"/>
|
||||||
|
<field name="minimum_advance"/>
|
||||||
|
</group>
|
||||||
<label name="cancellation_policies"/>
|
<label name="cancellation_policies"/>
|
||||||
<field name="cancellation_policies"/>
|
<field name="cancellation_policies"/>
|
||||||
<label name="price_list"/>
|
<label name="price_list"/>
|
||||||
|
|
|
@ -2,18 +2,26 @@
|
||||||
<!-- 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. -->
|
||||||
<form>
|
<form>
|
||||||
<label name="arrival_date"/>
|
<group colspan="4" col="6" id="dates">
|
||||||
<field name="arrival_date"/>
|
<label name="arrival_date"/>
|
||||||
<label name="departure_date"/>
|
<field name="arrival_date"/>
|
||||||
<field name="departure_date"/>
|
<label name="departure_date"/>
|
||||||
|
<field name="departure_date"/>
|
||||||
|
<label name="nights"/>
|
||||||
|
<field name="nights"/>
|
||||||
|
</group>
|
||||||
<label name="accommodation"/>
|
<label name="accommodation"/>
|
||||||
<field name="accommodation" widget="selection"/>
|
<field name="accommodation" widget="selection"/>
|
||||||
|
<label name="price_list"/>
|
||||||
|
<field name="price_list"/>
|
||||||
|
<group colspan="2" col="4" id="prices">
|
||||||
|
<label name="unit_price"/>
|
||||||
|
<field name="unit_price"/>
|
||||||
|
<label name="unit_price_w_tax"/>
|
||||||
|
<field name="unit_price_w_tax"/>
|
||||||
|
</group>
|
||||||
<label name="overbooking"/>
|
<label name="overbooking"/>
|
||||||
<field name="overbooking"/>
|
<field name="overbooking"/>
|
||||||
<label name="unit_price"/>
|
|
||||||
<field name="unit_price"/>
|
|
||||||
<label name="unit_price_w_tax"/>
|
|
||||||
<field name="unit_price_w_tax"/>
|
|
||||||
<field name="targets" invisible="1" colspan="4"/>
|
<field name="targets" invisible="1" colspan="4"/>
|
||||||
<field name="rooms" colspan="4"/>
|
<field name="rooms" colspan="4"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue