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',
|
||||
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):
|
||||
ctx = {}
|
||||
rate_plan = booking.rate_plan
|
||||
# rate_plan = booking.rate_plan
|
||||
unit_price = 0
|
||||
if rate_plan:
|
||||
ctx['price_list'] = rate_plan.price_list
|
||||
if self.price_list:
|
||||
ctx['price_list'] = self.price_list
|
||||
ctx['sale_date'] = self.arrival_date
|
||||
ctx['currency'] = booking.currency.id
|
||||
if booking.party:
|
||||
|
@ -1385,15 +1393,32 @@ class SelectRoomsAsk(ModelView):
|
|||
product = self.accommodation
|
||||
unit_price = product.template.list_price
|
||||
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):
|
||||
unit_price = rate_plan.price_list.compute(
|
||||
unit_price = self.price_list.compute(
|
||||
booking.party, product, unit_price,
|
||||
quantity, product.default_uom)
|
||||
unit_price = booking.currency.round(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):
|
||||
Booking = Pool().get('hotel.booking')
|
||||
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)
|
||||
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):
|
||||
Tax = Pool().get('account.tax')
|
||||
Booking = Pool().get('hotel.booking')
|
||||
|
|
2
folio.py
2
folio.py
|
@ -2521,7 +2521,7 @@ class GuestsListReport(Report):
|
|||
|
||||
guests = []
|
||||
for fo in folios:
|
||||
for guest in op.guests:
|
||||
for guest in fo.guests:
|
||||
guests.append({
|
||||
'room': fo.room.code,
|
||||
'guest': guest.name,
|
||||
|
|
38
locale/es.po
38
locale/es.po
|
@ -328,7 +328,7 @@ msgstr "Plan Comercial"
|
|||
|
||||
msgctxt "field:hotel.booking,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Lista de precios"
|
||||
msgstr "Tarifa"
|
||||
|
||||
msgctxt "field:hotel.booking,rate_plan:"
|
||||
msgid "Rate Plan"
|
||||
|
@ -434,10 +434,18 @@ msgctxt "field:hotel.booking.select_rooms.ask,departure_date:"
|
|||
msgid "Departure Date"
|
||||
msgstr "Fecha de Salida"
|
||||
|
||||
msgctxt "field:hotel.booking.select_rooms.ask,nights:"
|
||||
msgid "Nights"
|
||||
msgstr "Noches"
|
||||
|
||||
msgctxt "field:hotel.booking.select_rooms.ask,overbooking:"
|
||||
msgid "Overbooking"
|
||||
msgstr "Sobrereserva"
|
||||
|
||||
msgctxt "field:hotel.booking.select_rooms.ask,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Tarifa"
|
||||
|
||||
msgctxt "field:hotel.booking.select_rooms.ask,rooms:"
|
||||
msgid "Rooms"
|
||||
msgstr "Habitaciones"
|
||||
|
@ -582,6 +590,10 @@ msgctxt "field:hotel.configuration,age_children_policy:"
|
|||
msgid "Age Children Policy"
|
||||
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:"
|
||||
msgid "Booking Email"
|
||||
msgstr "Email Reserva"
|
||||
|
@ -663,13 +675,17 @@ msgid "Offset Journal"
|
|||
msgstr "Asiento de Cruze"
|
||||
|
||||
msgctxt "field:hotel.configuration,payment_term:"
|
||||
msgid "Payment Term"
|
||||
msgstr "Plazo de Pago"
|
||||
msgid "Default Payment Term"
|
||||
msgstr "Plazo de Pago por Defecto"
|
||||
|
||||
msgctxt "field:hotel.configuration,payments_email:"
|
||||
msgid "Payments 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:"
|
||||
msgid "Quarantine Rooms"
|
||||
msgstr "Cuarentena"
|
||||
|
@ -946,6 +962,10 @@ msgctxt "field:hotel.folio.charge,amount:"
|
|||
msgid "Amount"
|
||||
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:"
|
||||
msgid "Analytic Account"
|
||||
msgstr "Cuenta Analítica"
|
||||
|
@ -1543,8 +1563,8 @@ msgid "Party"
|
|||
msgstr "Tercero"
|
||||
|
||||
msgctxt "field:hotel.rate_plan,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Tarifa"
|
||||
msgid "Default Price List"
|
||||
msgstr "Tarifa por Defecto"
|
||||
|
||||
msgctxt "field:hotel.rate_plan,price_lists:"
|
||||
msgid "Price Lists"
|
||||
|
@ -2938,6 +2958,10 @@ msgid ""
|
|||
"sequence!"
|
||||
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"
|
||||
msgid "It missing guest in booking \"%(number)s\"!"
|
||||
msgstr "Falta el huesped en la reserva \"%(number)s\"!"
|
||||
|
@ -8873,6 +8897,10 @@ msgctxt "selection:hotel.configuration,accounting_revenue:"
|
|||
msgid "Recognise Revenue"
|
||||
msgstr "Reconocimiento de Ingresos"
|
||||
|
||||
msgctxt "selection:hotel.configuration,auto_invoice:"
|
||||
msgid "Validate and Send"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:hotel.configuration,full_clean_time:"
|
||||
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)
|
||||
end_date = fields.Date('End Date', required=True)
|
||||
season = fields.Selection([
|
||||
('', ''),
|
||||
('high', 'High'),
|
||||
('low', 'Low'),
|
||||
('middle', 'Middle'),
|
||||
|
@ -66,7 +67,7 @@ class RatePlan(Workflow, ModelSQL, ModelView):
|
|||
sunday = fields.Char('Sunday', help="Example, -15%")
|
||||
holiday = fields.Char('Holiday', help="Example, -15%")
|
||||
price_list = fields.Many2One('product.price_list', 'Default Price List',
|
||||
required=True)
|
||||
required=False)
|
||||
# Add children policy
|
||||
|
||||
@classmethod
|
||||
|
@ -107,34 +108,30 @@ class RatePlan(Workflow, ModelSQL, ModelView):
|
|||
Config = pool.get('hotel.configuration')
|
||||
rate_plan_id = args.get('rate_plan_id', None)
|
||||
arrival_date = args['arrival_date']
|
||||
|
||||
season = 'middle'
|
||||
rate_plan = None
|
||||
calendars = Calendar.search([
|
||||
('start_date', '>=', arrival_date),
|
||||
('end_date', '<=', arrival_date),
|
||||
('start_date', '<=', arrival_date),
|
||||
('end_date', '>=', arrival_date),
|
||||
])
|
||||
print("calendars....", calendars)
|
||||
|
||||
if calendars:
|
||||
season = calendars[0].season
|
||||
else:
|
||||
season = 'middle'
|
||||
|
||||
if rate_plan_id:
|
||||
rate_plan = cls(rate_plan_id)
|
||||
else:
|
||||
return {}
|
||||
|
||||
price_list = None
|
||||
for pl in rate_plan.price_lists:
|
||||
if pl.season == season:
|
||||
price_list = pl
|
||||
break
|
||||
|
||||
if not price_list:
|
||||
config = Config.get_configuration()
|
||||
if config.price_list:
|
||||
price_list = config.price_list
|
||||
else:
|
||||
# This is in deprecation
|
||||
price_list = rate_plan.price_list
|
||||
config = Config.get_configuration()
|
||||
if rate_plan_id:
|
||||
rate_plan = cls(rate_plan_id)
|
||||
for pl in rate_plan.price_lists:
|
||||
if pl.season == season:
|
||||
price_list = pl
|
||||
break
|
||||
elif config.price_list:
|
||||
price_list = config.price_list
|
||||
# else:
|
||||
# # This is in deprecation
|
||||
# price_list = rate_plan.price_list
|
||||
|
||||
if not 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"/>
|
||||
<label name="channel"/>
|
||||
<field name="channel" widget="selection"/>
|
||||
<label name="minimum_stay"/>
|
||||
<field name="minimum_stay"/>
|
||||
<label name="minimum_advance"/>
|
||||
<field name="minimum_advance"/>
|
||||
<group string="Stay Features" col="4" id="stay" colspan="2">
|
||||
<label name="minimum_stay"/>
|
||||
<field name="minimum_stay"/>
|
||||
<label name="minimum_advance"/>
|
||||
<field name="minimum_advance"/>
|
||||
</group>
|
||||
<label name="cancellation_policies"/>
|
||||
<field name="cancellation_policies"/>
|
||||
<label name="price_list"/>
|
||||
|
|
|
@ -2,18 +2,26 @@
|
|||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="arrival_date"/>
|
||||
<field name="arrival_date"/>
|
||||
<label name="departure_date"/>
|
||||
<field name="departure_date"/>
|
||||
<group colspan="4" col="6" id="dates">
|
||||
<label name="arrival_date"/>
|
||||
<field name="arrival_date"/>
|
||||
<label name="departure_date"/>
|
||||
<field name="departure_date"/>
|
||||
<label name="nights"/>
|
||||
<field name="nights"/>
|
||||
</group>
|
||||
<label name="accommodation"/>
|
||||
<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"/>
|
||||
<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="rooms" colspan="4"/>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue