Compare commits
4 Commits
e8e0f5237f
...
d135a1aeeb
Author | SHA1 | Date |
---|---|---|
oscar alvarez | d135a1aeeb | |
oscar alvarez | 579be5972b | |
oscar alvarez | dda7139f06 | |
oscar alvarez | e73def6507 |
108
booking.py
108
booking.py
|
@ -345,41 +345,56 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
for taxline in taxes.values():
|
||||
taxline['amount'] = self.currency.round(taxline['amount'])
|
||||
|
||||
def _get_taxes(self):
|
||||
pool = Pool()
|
||||
Tax = pool.get('account.tax')
|
||||
@classmethod
|
||||
def compute_taxes(cls, _taxes, unit_price, quantity, currency=None):
|
||||
Tax = Pool().get('account.tax')
|
||||
l_taxes = Tax.compute(list(_taxes), unit_price, quantity)
|
||||
taxes = []
|
||||
for tax in l_taxes:
|
||||
taxline = TaxableMixin._compute_tax_line(**tax)
|
||||
# Base must always be rounded per folio as there will
|
||||
# be one tax folio per taxable_lines
|
||||
if currency:
|
||||
taxline['base'] = currency.round(taxline['base'])
|
||||
taxes.append(taxline)
|
||||
return taxes
|
||||
|
||||
taxes = {}
|
||||
@classmethod
|
||||
def _get_taxes(cls, lines):
|
||||
taxes = []
|
||||
with Transaction().set_context({}):
|
||||
def compute(_taxes, unit_price, quantity):
|
||||
l_taxes = Tax.compute(list(_taxes), unit_price, quantity)
|
||||
for tax in l_taxes:
|
||||
taxline = TaxableMixin._compute_tax_line(**tax)
|
||||
# Base must always be rounded per folio as there will
|
||||
# be one tax folio per taxable_lines
|
||||
if self.currency:
|
||||
taxline['base'] = self.currency.round(taxline['base'])
|
||||
if taxline not in taxes:
|
||||
taxes[taxline] = taxline
|
||||
else:
|
||||
taxes[taxline]['base'] += taxline['base']
|
||||
taxes[taxline]['amount'] += taxline['amount']
|
||||
|
||||
for folio in self.lines:
|
||||
for folio in lines:
|
||||
currency = folio.booking.currency
|
||||
if folio.taxes_exception:
|
||||
continue
|
||||
_taxes = folio.product.customer_taxes_used
|
||||
if not folio.occupancy and not folio.charges:
|
||||
compute(_taxes, folio.unit_price, folio.nights_quantity)
|
||||
if not folio.occupancy:
|
||||
taxes.extend(cls.compute_taxes(
|
||||
_taxes,
|
||||
folio.unit_price,
|
||||
folio.nights_quantity,
|
||||
currency)
|
||||
)
|
||||
else:
|
||||
for occ in folio.occupancy:
|
||||
if not occ.charge:
|
||||
compute(_taxes, occ.unit_price, 1)
|
||||
taxes.extend(cls.compute_taxes(
|
||||
_taxes, occ.unit_price, 1, currency))
|
||||
|
||||
for charge in folio.charges:
|
||||
compute(charge.taxes, charge.unit_price, charge.quantity)
|
||||
|
||||
return taxes
|
||||
for charge in folio.charges:
|
||||
taxes.extend(cls.compute_taxes(
|
||||
charge.taxes,
|
||||
charge.unit_price,
|
||||
charge.quantity,
|
||||
currency))
|
||||
_taxes = {}
|
||||
for ctax in taxes:
|
||||
if ctax['tax'] not in _taxes.keys():
|
||||
_taxes[ctax['tax']] = ctax
|
||||
else:
|
||||
_taxes[ctax['tax']]['base'] += ctax['base']
|
||||
_taxes[ctax['tax']]['amount'] += ctax['amount']
|
||||
return _taxes.values()
|
||||
|
||||
def get_invoices(self, name=None):
|
||||
res = []
|
||||
|
@ -1218,7 +1233,8 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
return self.currency.round(res)
|
||||
|
||||
def get_tax_amount(self, name):
|
||||
taxes_computed = self._get_taxes()
|
||||
taxes_computed = Booking._get_taxes(self.lines)
|
||||
print('taxes_computed.....', taxes_computed)
|
||||
res = sum([t['amount'] for t in taxes_computed], _ZERO)
|
||||
return self.currency.round(res)
|
||||
|
||||
|
@ -1334,14 +1350,16 @@ class SelectRoomsAsk(ModelView):
|
|||
overbooking = fields.Boolean('Overbooking')
|
||||
targets = fields.Function(fields.Many2Many('hotel.room', None, None,
|
||||
'Targets'), 'on_change_with_targets')
|
||||
unit_price = fields.Numeric('Unit Price', digits=(16, 2), required=True)
|
||||
unit_price = fields.Numeric('Unit Price', digits=(16, 2), states={
|
||||
'readonly': True
|
||||
})
|
||||
unit_price_w_tax = fields.Numeric('Unit Price w Tax',
|
||||
digits=(16, 2), required=True)
|
||||
|
||||
@fields.depends('accommodation', 'departure_date', 'arrival_date')
|
||||
def on_change_with_unit_price(self):
|
||||
Booking = Pool().get('hotel.booking')
|
||||
booking = Booking(Transaction().context.get('active_id'))
|
||||
def _get_unit_price(self, booking):
|
||||
ctx = {}
|
||||
rate_plan = booking.rate_plan
|
||||
unit_price = 0
|
||||
if rate_plan:
|
||||
ctx['price_list'] = rate_plan.price_list
|
||||
ctx['sale_date'] = self.arrival_date
|
||||
|
@ -1358,7 +1376,31 @@ class SelectRoomsAsk(ModelView):
|
|||
booking.party, product, unit_price,
|
||||
quantity, product.default_uom)
|
||||
unit_price = booking.currency.round(unit_price)
|
||||
return unit_price
|
||||
return unit_price
|
||||
|
||||
@fields.depends('accommodation', 'departure_date', 'arrival_date')
|
||||
def on_change_with_unit_price_w_tax(self):
|
||||
Booking = Pool().get('hotel.booking')
|
||||
booking = Booking(Transaction().context.get('active_id'))
|
||||
unit_price = self._get_unit_price(booking)
|
||||
res = 0
|
||||
if self.accommodation and unit_price:
|
||||
_taxes = list(self.accommodation.customer_taxes_used)
|
||||
dict_taxes = Booking.compute_taxes(
|
||||
_taxes, unit_price, 1, booking.currency)
|
||||
res = sum(tx['base'] + tx['amount'] for tx in dict_taxes)
|
||||
return res
|
||||
|
||||
@fields.depends('unit_price_w_tax', 'accommodation', 'departure_date', 'arrival_date')
|
||||
def on_change_with_unit_price(self):
|
||||
Tax = Pool().get('account.tax')
|
||||
Booking = Pool().get('hotel.booking')
|
||||
booking = Booking(Transaction().context.get('active_id'))
|
||||
res = self._get_unit_price(booking)
|
||||
if self.accommodation and self.unit_price_w_tax:
|
||||
taxes = self.accommodation.customer_taxes_used
|
||||
res = Tax.reverse_compute(self.unit_price_w_tax, taxes)
|
||||
return res
|
||||
|
||||
@fields.depends('arrival_date', 'departure_date', 'accommodation',
|
||||
'overbooking')
|
||||
|
|
|
@ -77,7 +77,8 @@ class Configuration(ModelSQL, ModelView):
|
|||
storage_by_default = fields.Many2One('stock.location', 'Storage By Default',
|
||||
domain=[('type', '=', 'storage')], required=False)
|
||||
payment_term = fields.Many2One('account.invoice.payment_term',
|
||||
'Payment Term')
|
||||
'Default Payment Term')
|
||||
price_list = fields.Many2One('product.price_list', 'Default Price List')
|
||||
children_policies = fields.One2Many('hotel.children_policy',
|
||||
'configuration', 'Children Policies')
|
||||
nationality = fields.Many2One('country.country', 'Default Nationality')
|
||||
|
|
24
folio.py
24
folio.py
|
@ -1598,6 +1598,8 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
|
|||
readonly=True)
|
||||
amount = fields.Function(fields.Numeric('Amount', digits=(16, 2)),
|
||||
'get_amount')
|
||||
amount_w_tax = fields.Function(fields.Numeric('Amount w Tax',
|
||||
digits=(16, 2)), 'get_amount_w_tax')
|
||||
taxed_amount = fields.Function(fields.Numeric('Amount with Tax',
|
||||
digits=(16, 2)), 'get_taxed_amount')
|
||||
kind = fields.Selection([
|
||||
|
@ -1739,21 +1741,27 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
|
|||
return today
|
||||
|
||||
def get_amount(self, name=None):
|
||||
res = 0
|
||||
if self.quantity and self.unit_price:
|
||||
return self.quantity * self.unit_price
|
||||
return 0
|
||||
res = self.quantity * self.unit_price
|
||||
return res
|
||||
|
||||
def get_amount_w_tax(self, name=None):
|
||||
res = 0
|
||||
if self.quantity and self.unit_price_w_tax:
|
||||
res = self.quantity * self.unit_price_w_tax
|
||||
return res
|
||||
|
||||
def get_unit_price_w_tax(self, name=None):
|
||||
Tax = Pool().get('account.tax')
|
||||
res = self.unit_price or 0
|
||||
if self.unit_price and not self.folio.taxes_exception:
|
||||
values = Tax.compute(self.product.template.customer_taxes_used,
|
||||
_taxes = Tax.compute(
|
||||
self.product.template.customer_taxes_used,
|
||||
self.unit_price, 1)
|
||||
if values:
|
||||
value = values[0]
|
||||
res = value['base'] + value['amount']
|
||||
res = round(res, 2)
|
||||
return res
|
||||
for tax in _taxes:
|
||||
res += tax['amount']
|
||||
return round(res, 2)
|
||||
|
||||
def do_stock_move(self, name=None):
|
||||
pool = Pool()
|
||||
|
|
179
locale/es.po
179
locale/es.po
|
@ -84,7 +84,7 @@ msgstr "Icono"
|
|||
|
||||
msgctxt "field:dash.app.web_booking,kind:"
|
||||
msgid "Kind"
|
||||
msgstr "Tipo"
|
||||
msgstr "Clase"
|
||||
|
||||
msgctxt "field:dash.app.web_checkin,company:"
|
||||
msgid "Company"
|
||||
|
@ -146,7 +146,6 @@ msgctxt "field:hotel.bill_booking.start,party:"
|
|||
msgid "Bill To"
|
||||
msgstr "Facturar a"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "field:hotel.bill_booking.start,targets:"
|
||||
msgid "Targets"
|
||||
msgstr "Objetivos"
|
||||
|
@ -451,6 +450,10 @@ msgctxt "field:hotel.booking.select_rooms.ask,unit_price:"
|
|||
msgid "Unit Price"
|
||||
msgstr "Precio Unitario"
|
||||
|
||||
msgctxt "field:hotel.booking.select_rooms.ask,unit_price_w_tax:"
|
||||
msgid "Unit Price w Tax"
|
||||
msgstr "Precio Unit. con Imp."
|
||||
|
||||
msgctxt "field:hotel.booking.update_taxes.start,taxes_to_add:"
|
||||
msgid "Taxes to Add"
|
||||
msgstr "Impuestos a Agregar"
|
||||
|
@ -571,6 +574,10 @@ msgctxt "field:hotel.configuration,accounting_revenue:"
|
|||
msgid "Accounting Revenue"
|
||||
msgstr "Contabilidad de Ingresos"
|
||||
|
||||
msgctxt "field:hotel.configuration,advance_account:"
|
||||
msgid "Advance Account"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:hotel.configuration,age_children_policy:"
|
||||
msgid "Age Children Policy"
|
||||
msgstr "Pólitica de Niños"
|
||||
|
@ -1359,6 +1366,10 @@ msgctxt "field:hotel.payment_form.start,statement:"
|
|||
msgid "Statement"
|
||||
msgstr "Estado de Cuenta"
|
||||
|
||||
msgctxt "field:hotel.payment_form.start,statements:"
|
||||
msgid "Statements"
|
||||
msgstr "Estados de Cuenta"
|
||||
|
||||
msgctxt "field:hotel.payment_form.start,user:"
|
||||
msgid "User"
|
||||
msgstr "Usuario"
|
||||
|
@ -1483,6 +1494,14 @@ msgctxt "field:hotel.rate_plan,cancellation_condition:"
|
|||
msgid "Cancellation Condition"
|
||||
msgstr "Politica de Cancelación"
|
||||
|
||||
msgctxt "field:hotel.rate_plan,cancellation_policies:"
|
||||
msgid "Cancellation Policies"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:hotel.rate_plan,channel:"
|
||||
msgid "Channel"
|
||||
msgstr "Canal"
|
||||
|
||||
msgctxt "field:hotel.rate_plan,dinner:"
|
||||
msgid "Dinner"
|
||||
msgstr "Cena"
|
||||
|
@ -1503,6 +1522,10 @@ msgctxt "field:hotel.rate_plan,lunch:"
|
|||
msgid "Lunch"
|
||||
msgstr "Almuerzo"
|
||||
|
||||
msgctxt "field:hotel.rate_plan,minimum_advance:"
|
||||
msgid "Minimum Advance"
|
||||
msgstr "Mínima Antelación"
|
||||
|
||||
msgctxt "field:hotel.rate_plan,minimum_stay:"
|
||||
msgid "Minimum Stay"
|
||||
msgstr "Mínima Estancia"
|
||||
|
@ -1559,6 +1582,10 @@ msgctxt "field:hotel.rate_plan.calendar,end_date:"
|
|||
msgid "End Date"
|
||||
msgstr "Fin"
|
||||
|
||||
msgctxt "field:hotel.rate_plan.calendar,season:"
|
||||
msgid "Season"
|
||||
msgstr "Temporada"
|
||||
|
||||
msgctxt "field:hotel.rate_plan.calendar,start_date:"
|
||||
msgid "Start Date"
|
||||
msgstr "Inicio"
|
||||
|
@ -2027,6 +2054,10 @@ msgctxt "field:product.price_list,breakfast_included:"
|
|||
msgid "Breakfast Included"
|
||||
msgstr "Desayuno Incluido"
|
||||
|
||||
msgctxt "field:product.price_list,season:"
|
||||
msgid "Season"
|
||||
msgstr "Temporada"
|
||||
|
||||
msgctxt "field:product.template,accommodation_capacity:"
|
||||
msgid "Accommodation Capacity"
|
||||
msgstr "Capacidad de Acomodación"
|
||||
|
@ -2039,6 +2070,10 @@ msgctxt "field:product.template,kind:"
|
|||
msgid "Kind"
|
||||
msgstr "Clase"
|
||||
|
||||
msgctxt "field:sale.line,origin:"
|
||||
msgid "Origin"
|
||||
msgstr "Origen"
|
||||
|
||||
msgctxt "field:sale.sale,folio:"
|
||||
msgid "Folio"
|
||||
msgstr "Ocupación"
|
||||
|
@ -2055,10 +2090,30 @@ msgctxt "field:sale.sale-account.voucher,voucher:"
|
|||
msgid "Voucher"
|
||||
msgstr "Comprobante"
|
||||
|
||||
msgctxt "field:sale.transfer.start,folio:"
|
||||
msgid "Folio"
|
||||
msgstr "Folio"
|
||||
|
||||
msgctxt "field:sale.transfer.start,kind:"
|
||||
msgid "Kind"
|
||||
msgstr "Clase"
|
||||
|
||||
msgctxt "field:sale.transfer.start,sale:"
|
||||
msgid "Sale"
|
||||
msgstr "Venta"
|
||||
|
||||
msgctxt "field:sale.transfer_to_folio.start,folio:"
|
||||
msgid "Folio"
|
||||
msgstr "Folio"
|
||||
|
||||
msgctxt "field:sale.transfer_to_folio.start,kind:"
|
||||
msgid "Kind"
|
||||
msgstr "Clase"
|
||||
|
||||
msgctxt "field:sale.transfer_to_folio.start,sale:"
|
||||
msgid "Sale"
|
||||
msgstr "Venta"
|
||||
|
||||
msgctxt "help:hotel.booking,channel:"
|
||||
msgid "Agency or channel that do reservation."
|
||||
msgstr "Agencia o canal que hace la reserva."
|
||||
|
@ -2133,10 +2188,46 @@ msgctxt "help:hotel.maintenance,register_date:"
|
|||
msgid "The date of register of the issue"
|
||||
msgstr "Fecha de registro del problema"
|
||||
|
||||
msgctxt "help:hotel.rate_plan,friday:"
|
||||
msgid "Example, -15%"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:hotel.rate_plan,holiday:"
|
||||
msgid "Example, -15%"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:hotel.rate_plan,minimum_advance:"
|
||||
msgid "In days"
|
||||
msgstr "En días"
|
||||
|
||||
msgctxt "help:hotel.rate_plan,minimum_stay:"
|
||||
msgid "Minimun stay in days for to apply this plan rate"
|
||||
msgstr "Mínima estadia para aplicareste plan tarifario"
|
||||
|
||||
msgctxt "help:hotel.rate_plan,monday:"
|
||||
msgid "Example, -15%"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:hotel.rate_plan,saturday:"
|
||||
msgid "Example, -15%"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:hotel.rate_plan,sunday:"
|
||||
msgid "Example, -15%"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:hotel.rate_plan,thursday:"
|
||||
msgid "Example, -15%"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:hotel.rate_plan,tuesday:"
|
||||
msgid "Example, -15%"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:hotel.rate_plan,wednesday:"
|
||||
msgid "Example, -15%"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:hotel.room,space:"
|
||||
msgid "Space on m2"
|
||||
msgstr "Espacio en m2"
|
||||
|
@ -2267,7 +2358,7 @@ msgstr "Auditoria de Folios"
|
|||
|
||||
msgctxt "model:hotel.folio_charge-account.tax,name:"
|
||||
msgid "Hotel Folio Charge - Tax"
|
||||
msgstr ""
|
||||
msgstr "Cargos - Impuestos"
|
||||
|
||||
msgctxt "model:hotel.folio_update_occupancy.start,name:"
|
||||
msgid "Update Occupancy"
|
||||
|
@ -2351,7 +2442,7 @@ msgstr "Plan Tarifario"
|
|||
|
||||
msgctxt "model:hotel.rate_plan-product.price_list,name:"
|
||||
msgid "Rate Plan - Price List"
|
||||
msgstr ""
|
||||
msgstr "Plan Tarifario - Lista de Precios"
|
||||
|
||||
msgctxt "model:hotel.rate_plan.calendar,name:"
|
||||
msgid "Hotel Rate Plan Calendar"
|
||||
|
@ -2493,6 +2584,10 @@ msgctxt "model:ir.action,name:act_housekeeping_schedule_wizard"
|
|||
msgid "Housekeeping Schedule"
|
||||
msgstr "Programación de Amas de Llaves"
|
||||
|
||||
msgctxt "model:ir.action,name:act_invoice_reconcile_booking"
|
||||
msgid "Reconcile with Booking"
|
||||
msgstr "Conciliar con Reserva"
|
||||
|
||||
msgctxt "model:ir.action,name:act_location_tree"
|
||||
msgid "Locations"
|
||||
msgstr "Ubicaciones"
|
||||
|
@ -2525,9 +2620,9 @@ msgctxt "model:ir.action,name:act_room_housekeeping_form"
|
|||
msgid "Housekeeping"
|
||||
msgstr "Ama de Llaves"
|
||||
|
||||
msgctxt "model:ir.action,name:act_sale_transfer_to_folio"
|
||||
msgid "Transfer to Folio"
|
||||
msgstr "Transferir a Folio"
|
||||
msgctxt "model:ir.action,name:act_sale_transfer"
|
||||
msgid "Transfer"
|
||||
msgstr "Transferencia"
|
||||
|
||||
msgctxt "model:ir.action,name:act_service_kind_tree"
|
||||
msgid "Service Kind"
|
||||
|
@ -2619,7 +2714,7 @@ msgstr "Comprobante de Anticipo"
|
|||
|
||||
msgctxt "model:ir.action,name:wizard_booking_update_taxes"
|
||||
msgid "Update Taxes"
|
||||
msgstr ""
|
||||
msgstr "Actualizar Impuestos"
|
||||
|
||||
msgctxt "model:ir.action,name:wizard_folio_audit"
|
||||
msgid "Folio Audit Report"
|
||||
|
@ -2791,7 +2886,7 @@ msgstr "No puede hacer check-in de fechas futuras!"
|
|||
|
||||
msgctxt "model:ir.message,text:msg_charges_not_paid"
|
||||
msgid "There is charges not paid!"
|
||||
msgstr ""
|
||||
msgstr "Hay cargos no pagados!"
|
||||
|
||||
msgctxt "model:ir.message,text:msg_check_time_not_configured"
|
||||
msgid "The check out time is not configured!"
|
||||
|
@ -3139,6 +3234,10 @@ msgctxt "model:sale.sale-account.voucher,name:"
|
|||
msgid "Sale - Voucher"
|
||||
msgstr "Venta - Comprobante"
|
||||
|
||||
msgctxt "model:sale.transfer.start,name:"
|
||||
msgid "Sale Transfer Start"
|
||||
msgstr "Transferir Venta"
|
||||
|
||||
msgctxt "model:sale.transfer_to_folio.start,name:"
|
||||
msgid "Sale Transfer Folio Start"
|
||||
msgstr "Transferir a Folios"
|
||||
|
@ -9071,6 +9170,14 @@ msgctxt "selection:hotel.rate_plan,cancellation_condition:"
|
|||
msgid "Non-Refundable"
|
||||
msgstr "No Reembolsable"
|
||||
|
||||
msgctxt "selection:hotel.rate_plan,cancellation_policies:"
|
||||
msgid "Flexible"
|
||||
msgstr "Flexible"
|
||||
|
||||
msgctxt "selection:hotel.rate_plan,cancellation_policies:"
|
||||
msgid "Non-Refundable"
|
||||
msgstr "No Reembolsable"
|
||||
|
||||
msgctxt "selection:hotel.rate_plan,kind:"
|
||||
msgid "Agency"
|
||||
msgstr "Agencia"
|
||||
|
@ -9091,6 +9198,18 @@ msgctxt "selection:hotel.rate_plan,kind:"
|
|||
msgid "Web"
|
||||
msgstr "Web"
|
||||
|
||||
msgctxt "selection:hotel.rate_plan.calendar,season:"
|
||||
msgid "High"
|
||||
msgstr "Alta"
|
||||
|
||||
msgctxt "selection:hotel.rate_plan.calendar,season:"
|
||||
msgid "Low"
|
||||
msgstr "Baja"
|
||||
|
||||
msgctxt "selection:hotel.rate_plan.calendar,season:"
|
||||
msgid "Middle"
|
||||
msgstr "Media"
|
||||
|
||||
msgctxt "selection:hotel.rate_plan.calendar,type_:"
|
||||
msgid "High"
|
||||
msgstr "Alta"
|
||||
|
@ -9311,6 +9430,18 @@ msgctxt "selection:party.party,type_document:"
|
|||
msgid "PEP"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:product.price_list,season:"
|
||||
msgid "High"
|
||||
msgstr "Alta"
|
||||
|
||||
msgctxt "selection:product.price_list,season:"
|
||||
msgid "Low"
|
||||
msgstr "Baja"
|
||||
|
||||
msgctxt "selection:product.price_list,season:"
|
||||
msgid "Middle"
|
||||
msgstr "Media"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:product.template,kind:"
|
||||
msgid ""
|
||||
|
@ -9326,7 +9457,27 @@ msgstr "Bar y Restaurante"
|
|||
|
||||
msgctxt "selection:sale.sale,state:"
|
||||
msgid "Transfered"
|
||||
msgstr ""
|
||||
msgstr "Transferido"
|
||||
|
||||
msgctxt "selection:sale.sale,state:"
|
||||
msgid "Transferred"
|
||||
msgstr "Transferido"
|
||||
|
||||
msgctxt "selection:sale.transfer.start,kind:"
|
||||
msgid "Folio"
|
||||
msgstr "Folio"
|
||||
|
||||
msgctxt "selection:sale.transfer.start,kind:"
|
||||
msgid "Sale"
|
||||
msgstr "Venta"
|
||||
|
||||
msgctxt "selection:sale.transfer_to_folio.start,kind:"
|
||||
msgid "Folio"
|
||||
msgstr "Folio"
|
||||
|
||||
msgctxt "selection:sale.transfer_to_folio.start,kind:"
|
||||
msgid "Sale"
|
||||
msgstr "Venta"
|
||||
|
||||
msgctxt "view:company.company:"
|
||||
msgid "Property Info"
|
||||
|
@ -9756,6 +9907,14 @@ msgctxt "wizard_button:hotel.update_holder,start,update:"
|
|||
msgid "Update"
|
||||
msgstr "Actualizar"
|
||||
|
||||
msgctxt "wizard_button:sale.transfer,start,accept:"
|
||||
msgid "Ok"
|
||||
msgstr "Aceptar"
|
||||
|
||||
msgctxt "wizard_button:sale.transfer,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
msgctxt "wizard_button:sale.transfer_to_folio,start,accept:"
|
||||
msgid "Ok"
|
||||
msgstr "Aceptar"
|
||||
|
|
|
@ -117,5 +117,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_the_accommodation_not_charged">
|
||||
<field name="text">The accommodation is not charged!</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_missing_default_price_list">
|
||||
<field name="text">Missing default price list!</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
60
rate_plan.py
60
rate_plan.py
|
@ -2,8 +2,9 @@
|
|||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, fields, Workflow
|
||||
# from trytond.pyson import Eval, Bool
|
||||
# from trytond.pool import Pool
|
||||
from trytond.pool import Pool
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
|
||||
|
||||
class RatePlanCalendar(ModelSQL, ModelView):
|
||||
|
@ -64,8 +65,9 @@ class RatePlan(Workflow, ModelSQL, ModelView):
|
|||
saturday = fields.Char('Saturday', help="Example, -15%")
|
||||
sunday = fields.Char('Sunday', help="Example, -15%")
|
||||
holiday = fields.Char('Holiday', help="Example, -15%")
|
||||
price_list = fields.Many2One('product.price_list', 'Price List',
|
||||
required=False)
|
||||
price_list = fields.Many2One('product.price_list', 'Default Price List',
|
||||
required=True)
|
||||
# Add children policy
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -92,16 +94,52 @@ class RatePlan(Workflow, ModelSQL, ModelView):
|
|||
def default_active():
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def best_available_rate(cls, context):
|
||||
@classmethod
|
||||
def best_price_list(cls, args):
|
||||
"""Get the best available rate for the context
|
||||
arrival_date: Computed
|
||||
departure_date: Computed
|
||||
kind (rate_plan): Required
|
||||
arrival_date: Date
|
||||
departure_date: Date
|
||||
rate_plan: Required
|
||||
occupancy_rate for the arrival_date: Computed
|
||||
"""
|
||||
# rate_plan: Required
|
||||
pass
|
||||
pool = Pool()
|
||||
Calendar = pool.get('hotel.rate_plan.calendar')
|
||||
PriceList = pool.get('product.price_list')
|
||||
Config = pool.get('hotel.configuration')
|
||||
rate_plan_id = args['rate_plan_id']
|
||||
arrival_date = args['arrival_date']
|
||||
|
||||
calendars = Calendar.search([
|
||||
('start_date', '>=', args['arrival_date']),
|
||||
('end_date', '<=', arrival_date),
|
||||
])
|
||||
if calendars:
|
||||
season = calendars[0].season
|
||||
else:
|
||||
season = 'middle'
|
||||
|
||||
rate_plan = cls(rate_plan_id)
|
||||
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
|
||||
|
||||
|
||||
if not price_list:
|
||||
raise UserError(gettext('hotel.msg_missing_default_price_list'))
|
||||
|
||||
# Here add compute of price_list with variations of Context
|
||||
# including occupancy_rate and IA
|
||||
return price_list.id
|
||||
|
||||
|
||||
class RatePlanPriceList(ModelSQL):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.121
|
||||
version=6.0.124
|
||||
depends:
|
||||
party
|
||||
company
|
||||
|
|
|
@ -42,6 +42,10 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="charge_sequence"/>
|
||||
<label name="offset_journal"/>
|
||||
<field name="offset_journal"/>
|
||||
<label name="price_list"/>
|
||||
<field name="price_list"/>
|
||||
<label name="token_siat"/>
|
||||
<field name="token_siat"/>
|
||||
<group col="6" string="Accounting" id="account" colspan="4">
|
||||
<label name="accounting_revenue"/>
|
||||
<field name="accounting_revenue"/>
|
||||
|
@ -52,6 +56,4 @@ this repository contains the full copyright notices and license terms. -->
|
|||
</group>
|
||||
<field name="default_charges" colspan="2"/>
|
||||
<field name="children_policies" colspan="2"/>
|
||||
<label name="token_siat"/>
|
||||
<field name="token_siat"/>
|
||||
</form>
|
||||
|
|
|
@ -20,6 +20,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="unit_price_w_tax"/>
|
||||
<label name="amount"/>
|
||||
<field name="amount"/>
|
||||
<label name="amount_w_tax"/>
|
||||
<field name="amount_w_tax"/>
|
||||
<label name="kind"/>
|
||||
<field name="kind"/>
|
||||
<group col="8" id="invoice_state" string="Invoice State" colspan="4">
|
||||
|
|
|
@ -9,7 +9,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="quantity"/>
|
||||
<field name="unit_price" expand="1"/>
|
||||
<field name="unit_price_w_tax"/>
|
||||
<field name="amount" expand="1"/>
|
||||
<field name="amount_w_tax" expand="1"/>
|
||||
<field name="order"/>
|
||||
<field name="invoice_to"/>
|
||||
<field name="state" expand="1"/>
|
||||
|
|
|
@ -18,6 +18,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="minimum_advance"/>
|
||||
<label name="cancellation_policies"/>
|
||||
<field name="cancellation_policies"/>
|
||||
<label name="price_list"/>
|
||||
<field name="price_list"/>
|
||||
<group string="Food" col="8" id="food" colspan="4">
|
||||
<label name="all_inclusive"/>
|
||||
<field name="all_inclusive"/>
|
||||
|
|
|
@ -12,6 +12,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<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