Compare commits

...

4 Commits

Author SHA1 Message Date
oscar alvarez d135a1aeeb Fix amount compute 2023-11-04 17:20:09 -05:00
oscar alvarez 579be5972b Update version 2023-11-04 13:54:35 -05:00
oscar alvarez dda7139f06 Fix 2023-11-04 13:54:12 -05:00
oscar alvarez e73def6507 Add compute unit price w tax and reverse to unit price 2023-11-04 10:31:41 -05:00
12 changed files with 326 additions and 67 deletions

View File

@ -345,41 +345,56 @@ class Booking(Workflow, ModelSQL, ModelView):
for taxline in taxes.values(): for taxline in taxes.values():
taxline['amount'] = self.currency.round(taxline['amount']) taxline['amount'] = self.currency.round(taxline['amount'])
def _get_taxes(self): @classmethod
pool = Pool() def compute_taxes(cls, _taxes, unit_price, quantity, currency=None):
Tax = pool.get('account.tax') 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({}): with Transaction().set_context({}):
def compute(_taxes, unit_price, quantity): for folio in lines:
l_taxes = Tax.compute(list(_taxes), unit_price, quantity) currency = folio.booking.currency
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:
if folio.taxes_exception: if folio.taxes_exception:
continue continue
_taxes = folio.product.customer_taxes_used _taxes = folio.product.customer_taxes_used
if not folio.occupancy and not folio.charges: if not folio.occupancy:
compute(_taxes, folio.unit_price, folio.nights_quantity) taxes.extend(cls.compute_taxes(
_taxes,
folio.unit_price,
folio.nights_quantity,
currency)
)
else: else:
for occ in folio.occupancy: for occ in folio.occupancy:
if not occ.charge: 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: for charge in folio.charges:
compute(charge.taxes, charge.unit_price, charge.quantity) taxes.extend(cls.compute_taxes(
charge.taxes,
return 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): def get_invoices(self, name=None):
res = [] res = []
@ -1218,7 +1233,8 @@ class Booking(Workflow, ModelSQL, ModelView):
return self.currency.round(res) return self.currency.round(res)
def get_tax_amount(self, name): 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) res = sum([t['amount'] for t in taxes_computed], _ZERO)
return self.currency.round(res) return self.currency.round(res)
@ -1334,14 +1350,16 @@ class SelectRoomsAsk(ModelView):
overbooking = fields.Boolean('Overbooking') overbooking = fields.Boolean('Overbooking')
targets = fields.Function(fields.Many2Many('hotel.room', None, None, targets = fields.Function(fields.Many2Many('hotel.room', None, None,
'Targets'), 'on_change_with_targets') '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 _get_unit_price(self, booking):
def on_change_with_unit_price(self):
Booking = Pool().get('hotel.booking')
booking = Booking(Transaction().context.get('active_id'))
ctx = {} ctx = {}
rate_plan = booking.rate_plan rate_plan = booking.rate_plan
unit_price = 0
if rate_plan: if rate_plan:
ctx['price_list'] = rate_plan.price_list ctx['price_list'] = rate_plan.price_list
ctx['sale_date'] = self.arrival_date ctx['sale_date'] = self.arrival_date
@ -1358,7 +1376,31 @@ class SelectRoomsAsk(ModelView):
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')
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', @fields.depends('arrival_date', 'departure_date', 'accommodation',
'overbooking') 'overbooking')

View File

@ -77,7 +77,8 @@ class Configuration(ModelSQL, ModelView):
storage_by_default = fields.Many2One('stock.location', 'Storage By Default', storage_by_default = fields.Many2One('stock.location', 'Storage By Default',
domain=[('type', '=', 'storage')], required=False) domain=[('type', '=', 'storage')], required=False)
payment_term = fields.Many2One('account.invoice.payment_term', 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', children_policies = fields.One2Many('hotel.children_policy',
'configuration', 'Children Policies') 'configuration', 'Children Policies')
nationality = fields.Many2One('country.country', 'Default Nationality') nationality = fields.Many2One('country.country', 'Default Nationality')

View File

@ -1598,6 +1598,8 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
readonly=True) readonly=True)
amount = fields.Function(fields.Numeric('Amount', digits=(16, 2)), amount = fields.Function(fields.Numeric('Amount', digits=(16, 2)),
'get_amount') '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', taxed_amount = fields.Function(fields.Numeric('Amount with Tax',
digits=(16, 2)), 'get_taxed_amount') digits=(16, 2)), 'get_taxed_amount')
kind = fields.Selection([ kind = fields.Selection([
@ -1739,21 +1741,27 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
return today return today
def get_amount(self, name=None): def get_amount(self, name=None):
res = 0
if self.quantity and self.unit_price: if self.quantity and self.unit_price:
return self.quantity * self.unit_price res = self.quantity * self.unit_price
return 0 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): def get_unit_price_w_tax(self, name=None):
Tax = Pool().get('account.tax') Tax = Pool().get('account.tax')
res = self.unit_price or 0 res = self.unit_price or 0
if self.unit_price and not self.folio.taxes_exception: 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) self.unit_price, 1)
if values: for tax in _taxes:
value = values[0] res += tax['amount']
res = value['base'] + value['amount'] return round(res, 2)
res = round(res, 2)
return res
def do_stock_move(self, name=None): def do_stock_move(self, name=None):
pool = Pool() pool = Pool()

View File

@ -84,7 +84,7 @@ msgstr "Icono"
msgctxt "field:dash.app.web_booking,kind:" msgctxt "field:dash.app.web_booking,kind:"
msgid "Kind" msgid "Kind"
msgstr "Tipo" msgstr "Clase"
msgctxt "field:dash.app.web_checkin,company:" msgctxt "field:dash.app.web_checkin,company:"
msgid "Company" msgid "Company"
@ -146,7 +146,6 @@ msgctxt "field:hotel.bill_booking.start,party:"
msgid "Bill To" msgid "Bill To"
msgstr "Facturar a" msgstr "Facturar a"
#, fuzzy
msgctxt "field:hotel.bill_booking.start,targets:" msgctxt "field:hotel.bill_booking.start,targets:"
msgid "Targets" msgid "Targets"
msgstr "Objetivos" msgstr "Objetivos"
@ -451,6 +450,10 @@ msgctxt "field:hotel.booking.select_rooms.ask,unit_price:"
msgid "Unit Price" msgid "Unit Price"
msgstr "Precio Unitario" 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:" msgctxt "field:hotel.booking.update_taxes.start,taxes_to_add:"
msgid "Taxes to Add" msgid "Taxes to Add"
msgstr "Impuestos a Agregar" msgstr "Impuestos a Agregar"
@ -571,6 +574,10 @@ msgctxt "field:hotel.configuration,accounting_revenue:"
msgid "Accounting Revenue" msgid "Accounting Revenue"
msgstr "Contabilidad de Ingresos" msgstr "Contabilidad de Ingresos"
msgctxt "field:hotel.configuration,advance_account:"
msgid "Advance Account"
msgstr ""
msgctxt "field:hotel.configuration,age_children_policy:" 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"
@ -1359,6 +1366,10 @@ msgctxt "field:hotel.payment_form.start,statement:"
msgid "Statement" msgid "Statement"
msgstr "Estado de Cuenta" msgstr "Estado de Cuenta"
msgctxt "field:hotel.payment_form.start,statements:"
msgid "Statements"
msgstr "Estados de Cuenta"
msgctxt "field:hotel.payment_form.start,user:" msgctxt "field:hotel.payment_form.start,user:"
msgid "User" msgid "User"
msgstr "Usuario" msgstr "Usuario"
@ -1483,6 +1494,14 @@ msgctxt "field:hotel.rate_plan,cancellation_condition:"
msgid "Cancellation Condition" msgid "Cancellation Condition"
msgstr "Politica de Cancelación" 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:" msgctxt "field:hotel.rate_plan,dinner:"
msgid "Dinner" msgid "Dinner"
msgstr "Cena" msgstr "Cena"
@ -1503,6 +1522,10 @@ msgctxt "field:hotel.rate_plan,lunch:"
msgid "Lunch" msgid "Lunch"
msgstr "Almuerzo" msgstr "Almuerzo"
msgctxt "field:hotel.rate_plan,minimum_advance:"
msgid "Minimum Advance"
msgstr "Mínima Antelación"
msgctxt "field:hotel.rate_plan,minimum_stay:" msgctxt "field:hotel.rate_plan,minimum_stay:"
msgid "Minimum Stay" msgid "Minimum Stay"
msgstr "Mínima Estancia" msgstr "Mínima Estancia"
@ -1559,6 +1582,10 @@ msgctxt "field:hotel.rate_plan.calendar,end_date:"
msgid "End Date" msgid "End Date"
msgstr "Fin" msgstr "Fin"
msgctxt "field:hotel.rate_plan.calendar,season:"
msgid "Season"
msgstr "Temporada"
msgctxt "field:hotel.rate_plan.calendar,start_date:" msgctxt "field:hotel.rate_plan.calendar,start_date:"
msgid "Start Date" msgid "Start Date"
msgstr "Inicio" msgstr "Inicio"
@ -2027,6 +2054,10 @@ msgctxt "field:product.price_list,breakfast_included:"
msgid "Breakfast Included" msgid "Breakfast Included"
msgstr "Desayuno Incluido" msgstr "Desayuno Incluido"
msgctxt "field:product.price_list,season:"
msgid "Season"
msgstr "Temporada"
msgctxt "field:product.template,accommodation_capacity:" msgctxt "field:product.template,accommodation_capacity:"
msgid "Accommodation Capacity" msgid "Accommodation Capacity"
msgstr "Capacidad de Acomodación" msgstr "Capacidad de Acomodación"
@ -2039,6 +2070,10 @@ msgctxt "field:product.template,kind:"
msgid "Kind" msgid "Kind"
msgstr "Clase" msgstr "Clase"
msgctxt "field:sale.line,origin:"
msgid "Origin"
msgstr "Origen"
msgctxt "field:sale.sale,folio:" msgctxt "field:sale.sale,folio:"
msgid "Folio" msgid "Folio"
msgstr "Ocupación" msgstr "Ocupación"
@ -2055,10 +2090,30 @@ msgctxt "field:sale.sale-account.voucher,voucher:"
msgid "Voucher" msgid "Voucher"
msgstr "Comprobante" 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:" msgctxt "field:sale.transfer_to_folio.start,folio:"
msgid "Folio" msgid "Folio"
msgstr "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:" msgctxt "help:hotel.booking,channel:"
msgid "Agency or channel that do reservation." msgid "Agency or channel that do reservation."
msgstr "Agencia o canal que hace la reserva." 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" msgid "The date of register of the issue"
msgstr "Fecha de registro del problema" 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:" msgctxt "help:hotel.rate_plan,minimum_stay:"
msgid "Minimun stay in days for to apply this plan rate" msgid "Minimun stay in days for to apply this plan rate"
msgstr "Mínima estadia para aplicareste plan tarifario" 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:" msgctxt "help:hotel.room,space:"
msgid "Space on m2" msgid "Space on m2"
msgstr "Espacio en m2" msgstr "Espacio en m2"
@ -2267,7 +2358,7 @@ msgstr "Auditoria de Folios"
msgctxt "model:hotel.folio_charge-account.tax,name:" msgctxt "model:hotel.folio_charge-account.tax,name:"
msgid "Hotel Folio Charge - Tax" msgid "Hotel Folio Charge - Tax"
msgstr "" msgstr "Cargos - Impuestos"
msgctxt "model:hotel.folio_update_occupancy.start,name:" msgctxt "model:hotel.folio_update_occupancy.start,name:"
msgid "Update Occupancy" msgid "Update Occupancy"
@ -2351,7 +2442,7 @@ msgstr "Plan Tarifario"
msgctxt "model:hotel.rate_plan-product.price_list,name:" msgctxt "model:hotel.rate_plan-product.price_list,name:"
msgid "Rate Plan - Price List" msgid "Rate Plan - Price List"
msgstr "" msgstr "Plan Tarifario - Lista de Precios"
msgctxt "model:hotel.rate_plan.calendar,name:" msgctxt "model:hotel.rate_plan.calendar,name:"
msgid "Hotel Rate Plan Calendar" msgid "Hotel Rate Plan Calendar"
@ -2493,6 +2584,10 @@ msgctxt "model:ir.action,name:act_housekeeping_schedule_wizard"
msgid "Housekeeping Schedule" msgid "Housekeeping Schedule"
msgstr "Programación de Amas de Llaves" 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" msgctxt "model:ir.action,name:act_location_tree"
msgid "Locations" msgid "Locations"
msgstr "Ubicaciones" msgstr "Ubicaciones"
@ -2525,9 +2620,9 @@ msgctxt "model:ir.action,name:act_room_housekeeping_form"
msgid "Housekeeping" msgid "Housekeeping"
msgstr "Ama de Llaves" msgstr "Ama de Llaves"
msgctxt "model:ir.action,name:act_sale_transfer_to_folio" msgctxt "model:ir.action,name:act_sale_transfer"
msgid "Transfer to Folio" msgid "Transfer"
msgstr "Transferir a Folio" msgstr "Transferencia"
msgctxt "model:ir.action,name:act_service_kind_tree" msgctxt "model:ir.action,name:act_service_kind_tree"
msgid "Service Kind" msgid "Service Kind"
@ -2619,7 +2714,7 @@ msgstr "Comprobante de Anticipo"
msgctxt "model:ir.action,name:wizard_booking_update_taxes" msgctxt "model:ir.action,name:wizard_booking_update_taxes"
msgid "Update Taxes" msgid "Update Taxes"
msgstr "" msgstr "Actualizar Impuestos"
msgctxt "model:ir.action,name:wizard_folio_audit" msgctxt "model:ir.action,name:wizard_folio_audit"
msgid "Folio Audit Report" 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" msgctxt "model:ir.message,text:msg_charges_not_paid"
msgid "There is 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" msgctxt "model:ir.message,text:msg_check_time_not_configured"
msgid "The check out time is not configured!" msgid "The check out time is not configured!"
@ -3139,6 +3234,10 @@ msgctxt "model:sale.sale-account.voucher,name:"
msgid "Sale - Voucher" msgid "Sale - Voucher"
msgstr "Venta - Comprobante" msgstr "Venta - Comprobante"
msgctxt "model:sale.transfer.start,name:"
msgid "Sale Transfer Start"
msgstr "Transferir Venta"
msgctxt "model:sale.transfer_to_folio.start,name:" msgctxt "model:sale.transfer_to_folio.start,name:"
msgid "Sale Transfer Folio Start" msgid "Sale Transfer Folio Start"
msgstr "Transferir a Folios" msgstr "Transferir a Folios"
@ -9071,6 +9170,14 @@ msgctxt "selection:hotel.rate_plan,cancellation_condition:"
msgid "Non-Refundable" msgid "Non-Refundable"
msgstr "No Reembolsable" 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:" msgctxt "selection:hotel.rate_plan,kind:"
msgid "Agency" msgid "Agency"
msgstr "Agencia" msgstr "Agencia"
@ -9091,6 +9198,18 @@ msgctxt "selection:hotel.rate_plan,kind:"
msgid "Web" msgid "Web"
msgstr "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_:" msgctxt "selection:hotel.rate_plan.calendar,type_:"
msgid "High" msgid "High"
msgstr "Alta" msgstr "Alta"
@ -9311,6 +9430,18 @@ msgctxt "selection:party.party,type_document:"
msgid "PEP" msgid "PEP"
msgstr "" 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 #, fuzzy
msgctxt "selection:product.template,kind:" msgctxt "selection:product.template,kind:"
msgid "" msgid ""
@ -9326,7 +9457,27 @@ msgstr "Bar y Restaurante"
msgctxt "selection:sale.sale,state:" msgctxt "selection:sale.sale,state:"
msgid "Transfered" 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:" msgctxt "view:company.company:"
msgid "Property Info" msgid "Property Info"
@ -9756,6 +9907,14 @@ msgctxt "wizard_button:hotel.update_holder,start,update:"
msgid "Update" msgid "Update"
msgstr "Actualizar" 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:" msgctxt "wizard_button:sale.transfer_to_folio,start,accept:"
msgid "Ok" msgid "Ok"
msgstr "Aceptar" msgstr "Aceptar"

View File

@ -117,5 +117,8 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.message" id="msg_the_accommodation_not_charged"> <record model="ir.message" id="msg_the_accommodation_not_charged">
<field name="text">The accommodation is not charged!</field> <field name="text">The accommodation is not charged!</field>
</record> </record>
<record model="ir.message" id="msg_missing_default_price_list">
<field name="text">Missing default price list!</field>
</record>
</data> </data>
</tryton> </tryton>

View File

@ -2,8 +2,9 @@
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, fields, Workflow 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): class RatePlanCalendar(ModelSQL, ModelView):
@ -64,8 +65,9 @@ class RatePlan(Workflow, ModelSQL, ModelView):
saturday = fields.Char('Saturday', help="Example, -15%") saturday = fields.Char('Saturday', help="Example, -15%")
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', 'Price List', price_list = fields.Many2One('product.price_list', 'Default Price List',
required=False) required=True)
# Add children policy
@classmethod @classmethod
def __setup__(cls): def __setup__(cls):
@ -92,16 +94,52 @@ class RatePlan(Workflow, ModelSQL, ModelView):
def default_active(): def default_active():
return True return True
@staticmethod @classmethod
def best_available_rate(cls, context): def best_price_list(cls, args):
"""Get the best available rate for the context """Get the best available rate for the context
arrival_date: Computed arrival_date: Date
departure_date: Computed departure_date: Date
kind (rate_plan): Required rate_plan: Required
occupancy_rate for the arrival_date: Computed occupancy_rate for the arrival_date: Computed
""" """
# rate_plan: Required pool = Pool()
pass 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): class RatePlanPriceList(ModelSQL):

View File

@ -1,5 +1,5 @@
[tryton] [tryton]
version=6.0.121 version=6.0.124
depends: depends:
party party
company company

View File

@ -42,6 +42,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="charge_sequence"/> <field name="charge_sequence"/>
<label name="offset_journal"/> <label name="offset_journal"/>
<field 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"> <group col="6" string="Accounting" id="account" colspan="4">
<label name="accounting_revenue"/> <label name="accounting_revenue"/>
<field name="accounting_revenue"/> <field name="accounting_revenue"/>
@ -52,6 +56,4 @@ this repository contains the full copyright notices and license terms. -->
</group> </group>
<field name="default_charges" colspan="2"/> <field name="default_charges" colspan="2"/>
<field name="children_policies" colspan="2"/> <field name="children_policies" colspan="2"/>
<label name="token_siat"/>
<field name="token_siat"/>
</form> </form>

View File

@ -20,6 +20,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="amount"/> <label name="amount"/>
<field name="amount"/> <field name="amount"/>
<label name="amount_w_tax"/>
<field name="amount_w_tax"/>
<label name="kind"/> <label name="kind"/>
<field name="kind"/> <field name="kind"/>
<group col="8" id="invoice_state" string="Invoice State" colspan="4"> <group col="8" id="invoice_state" string="Invoice State" colspan="4">

View File

@ -9,7 +9,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="quantity"/> <field name="quantity"/>
<field name="unit_price" expand="1"/> <field name="unit_price" expand="1"/>
<field name="unit_price_w_tax"/> <field name="unit_price_w_tax"/>
<field name="amount" expand="1"/> <field name="amount_w_tax" expand="1"/>
<field name="order"/> <field name="order"/>
<field name="invoice_to"/> <field name="invoice_to"/>
<field name="state" expand="1"/> <field name="state" expand="1"/>

View File

@ -18,6 +18,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="minimum_advance"/> <field name="minimum_advance"/>
<label name="cancellation_policies"/> <label name="cancellation_policies"/>
<field name="cancellation_policies"/> <field name="cancellation_policies"/>
<label name="price_list"/>
<field name="price_list"/>
<group string="Food" col="8" id="food" colspan="4"> <group string="Food" col="8" id="food" colspan="4">
<label name="all_inclusive"/> <label name="all_inclusive"/>
<field name="all_inclusive"/> <field name="all_inclusive"/>

View File

@ -12,6 +12,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="overbooking"/> <field name="overbooking"/>
<label name="unit_price"/> <label name="unit_price"/>
<field 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>