This commit is contained in:
oscar alvarez 2022-03-19 09:46:34 -05:00
parent 028aa49e0a
commit 883e2a84cd
11 changed files with 143 additions and 28 deletions

View File

@ -22,26 +22,23 @@ from . import invoice
def register():
Pool.register(
room.RoomClassification,
location.HotelLocation,
channel.SaleChannel,
room.Room,
policy.HotelPolicyCancellation,
configuration.Configuration,
room.Amenities,
room.RoomAmenities,
room.RoomTemplate,
city.MigrationCity,
location.HotelLocation,
channel.SaleChannel,
policy.HotelPolicyCancellation,
company.Company,
configuration.ConfigurationProduct,
configuration.Configuration,
product.Template,
product.PriceList,
city.MigrationCity,
booking.Booking,
booking.BookingDailyStart,
configuration.ConfigurationProduct,
housekeeping.Housekeeping,
housekeeping.HousekeepingCleaningType,
company.Company,
folio.Folio,
folio.FolioCharge,
folio.FolioStockMove,
folio.OpenMigrationStart,
party.Party,
channel.ChannelTax,
booking.SelectRoomsAsk,
@ -51,12 +48,15 @@ def register():
folio.FolioGuest,
folio.GuestsListStart,
folio.StatisticsByMonthStart,
folio.Folio,
folio.FolioCharge,
folio.FolioStockMove,
folio.OpenMigrationStart,
sale.InvoiceIncomeDailyStart,
service.Service,
service.ServiceLine,
service.ServiceKind,
service.CreateDailyServicesStart,
room.RoomTemplate,
housekeeping.HotelHousekeepingTask,
housekeeping.HotelTask,
housekeeping.HousekeepingServiceStart,
@ -92,6 +92,7 @@ def register():
folio.OpenMigration,
folio.GuestsList,
folio.StatisticsByMonth,
folio.ReverseCheckout,
service.CreateDailyServices,
housekeeping.HousekeepingService,
sale.InvoiceIncomeDaily,

View File

@ -175,7 +175,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'invisible': Eval('state') != 'confirmed'
},
'bill': {
'invisible': Eval('state') != 'confirmed',
'invisible': ~Eval('state').in_(['confirmed', 'not_show']),
},
})
@ -690,7 +690,7 @@ class Booking(Workflow, ModelSQL, ModelView):
def get_untaxed_amount(self, name):
res = _ZERO
for line in self.lines:
res += line.total_amount
res += line.total_balance
return res
# def get_occupancies(self, name):

View File

@ -113,7 +113,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="domain" eval="[]" pyson="1"/>
<field name="act_window" ref="act_booking_form"/>
</record>
<menuitem parent="menu_hotel" sequence="10"
<menuitem parent="menu_hotel" sequence="10" icon="hotel-booking"
action="act_booking_form" id="menu_booking_form"/>
<record model="ir.ui.view" id="booking_folio_view_tree">

View File

@ -97,7 +97,9 @@ class Folio(ModelSQL, ModelView):
unit_digits = fields.Function(fields.Integer('Unit Digits'), 'get_unit_digits')
notes = fields.Text('Notes')
total_amount = fields.Function(fields.Numeric('Total Amount',
digits=(16, 2)), 'get_total_amount')
digits=(16, 2)), 'get_totals')
total_balance = fields.Function(fields.Numeric('Total Balance',
digits=(16, 2), depends=['paid_by_channel']), 'get_totals')
commission_amount = fields.Numeric('Commission Amount', digits=(16, 2),
depends=['product', 'departure_date', 'arrival_date']
)
@ -135,6 +137,7 @@ class Folio(ModelSQL, ModelView):
breakfast_included = fields.Boolean('Breakfast Included', states={
'readonly': Eval('registration_state') != 'check_in',
})
paid_by_channel = fields.Boolean('Paid By Channel')
room_amount = fields.Function(fields.Numeric('Room Amount',
digits=(16, 2)), 'get_change_with_room_amount')
stock_moves = fields.Many2Many('hotel.folio-stock.move', 'folio',
@ -440,15 +443,16 @@ class Folio(ModelSQL, ModelView):
nights = (self.departure_date - self.arrival_date).days
return nights
def get_total_amount(self, name):
def get_totals(self, name):
"""
The total amount of booking based on room flat price.
TODO: If room fee is applied should be used for total price calculation
instead of flat price. Fee is linked to channel management.
"""
res = []
if self.nights_quantity and self.unit_price_w_tax:
res = [self.nights_quantity * self.unit_price_w_tax]
if name == 'total_amount' or not self.paid_by_channel:
if self.nights_quantity and self.unit_price_w_tax:
res = [self.nights_quantity * self.unit_price_w_tax]
for charge in self.charges:
res.append(charge.amount)
res = round(sum(res), Folio.total_amount.digits[1])
@ -1151,10 +1155,9 @@ class OperationVoucher(ModelSQL):
__name__ = 'hotel.folio-account.voucher'
_table = 'folio_vouchers_rel'
folio = fields.Many2One('hotel.folio', 'Folio',
ondelete='CASCADE', select=True, required=True)
voucher = fields.Many2One('account.voucher', 'Voucher', select=True,
domain=[('voucher_type', '=', 'receipt')], ondelete='RESTRICT',
required=True)
ondelete='CASCADE', required=True)
voucher = fields.Many2One('account.voucher', 'Voucher', required=True,
domain=[('voucher_type', '=', 'receipt')], ondelete='RESTRICT')
@classmethod
def set_voucher_origin(cls, voucher_id, folio_id):
@ -1164,6 +1167,20 @@ class OperationVoucher(ModelSQL):
}])
class ReverseCheckout(Wizard):
'Reverse Checkout'
__name__ = 'hotel.folio.reverse_checkout'
start_state = 'reverse_checkout'
reverse_checkout = StateTransition()
def transition_reverse_checkout(self):
Folio = Pool().get('hotel.folio')
folio_id = Transaction().context['active_id']
if folio_id:
Folio.check_in([Folio(folio_id)])
return 'end'
class FolioStockMove(ModelSQL):
'Folio - Stock Move'
__name__ = 'hotel.folio-stock.move'

View File

@ -51,7 +51,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="view" ref="board_folio_view_form"/>
<field name="act_window" ref="act_board_folio_view"/>
</record>
<menuitem parent="menu_booking_form" sequence="30"
<menuitem parent="menu_hotel" sequence="20" icon="hotel-frontdesk"
action="act_board_folio_view" id="menu_hotel_board_folio"/>
<record model="ir.action.act_window.domain" id="act_guest_moves_form_domain_arriving_today">
@ -128,6 +128,16 @@ this repository contains the full copyright notices and license terms. -->
<menuitem name="Migration Report" sequence="60" parent="menu_reporting"
id="menu_migration_report" action="act_open_migration"/>
<record model="ir.action.wizard" id="act_folio_reverse_checkout">
<field name="name">Reverse Check Out</field>
<field name="wiz_name">hotel.folio.reverse_checkout</field>
</record>
<record model="ir.action.keyword" id="action_folio_reverse_checkout_keyword">
<field name="keyword">form_action</field>
<field name="model">hotel.folio,-1</field>
<field name="action" ref="act_folio_reverse_checkout"/>
</record>
<!-- <record model="ir.ui.view" id="operation_maintenance_view_tree">
<field name="model">hotel.operation.maintenance</field>
<field name="type">tree</field>

View File

@ -23,6 +23,14 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">tryton-hotel</field>
<field name="path">icons/tryton-hotel.svg</field>
</record>
<record model="ir.ui.icon" id="hotel_frontdesk_icon">
<field name="name">hotel-frontdesk</field>
<field name="path">icons/frontdesk.svg</field>
</record>
<record model="ir.ui.icon" id="hotel_booking_icon">
<field name="name">hotel-booking</field>
<field name="path">icons/booking.svg</field>
</record>
<menuitem name="Hotel" sequence="10" id="menu_hotel"
icon="tryton-hotel" />

67
icons/booking.svg Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 511.999 511.999" style="enable-background:new 0 0 511.999 511.999;" xml:space="preserve">
<path style="fill:#CFDCE5;" d="M60.037,294.609h393.116v-1.273c0-26.436-21.43-47.867-47.867-47.867H107.902
c-26.436,0-47.867,21.43-47.867,47.867v1.273H60.037z"/>
<g>
<path style="fill:#BAC6CC;" d="M154.014,245.469h-46.112c-26.436,0-47.867,21.43-47.867,47.867v1.273h46.112v-1.273
C106.148,266.9,127.578,245.469,154.014,245.469z"/>
<path style="fill:#BAC6CC;" d="M359.173,245.469h46.112c26.436,0,47.866,21.43,47.866,47.867v1.273H407.04v-1.273
C407.04,266.9,385.609,245.469,359.173,245.469z"/>
</g>
<path style="fill:#CFDCE5;" d="M279.615,220.468c-4.924,8.765-10.292,17.096-16.082,25.006H112.029
c-5.79-7.91-11.147-16.241-16.082-25.006c22.031-39.184,52.644-69.774,91.817-91.828c0.011-0.011,0.011-0.011,0.011-0.011
C226.96,150.682,257.573,181.284,279.615,220.468z"/>
<g>
<rect x="9.141" y="82.254" style="fill:#FCD577;" width="50.895" height="347.482"/>
<rect x="453.146" y="205.22" style="fill:#FCD577;" width="50.895" height="224.527"/>
<rect x="60.037" y="294.609" style="fill:#FCD577;" width="393.117" height="98.279"/>
</g>
<rect x="427.97" y="294.609" style="fill:#EAC36E;" width="25.177" height="98.279"/>
<path style="fill:#BAC6CC;" d="M144.192,245.474h-32.163c-5.79-7.91-11.147-16.241-16.082-25.006
c22.031-39.184,52.644-69.774,91.817-91.828C186.978,129.723,130.607,207.236,144.192,245.474z"/>
<path d="M503.452,196.666h-50.894c-4.721,0-8.548,3.827-8.548,8.548v47.721c-10.169-9.9-24.039-16.014-39.319-16.014h-125.58
c2.553-4.011,5.019-8.1,7.359-12.264c1.462-2.602,1.462-5.778-0.001-8.379c-22.717-40.383-54.712-72.378-95.096-95.096
c-2.602-1.465-5.78-1.465-8.383,0c-40.393,22.731-72.384,54.727-95.085,95.097c-1.462,2.601-1.462,5.776,0,8.378
c2.562,4.557,5.262,9.035,8.077,13.406c-10.759,2.202-20.405,7.485-27.993,14.871V82.256c0-4.721-3.827-8.548-8.548-8.548H8.548
C3.827,73.708,0,77.535,0,82.256v40.092c0,4.721,3.827,8.548,8.548,8.548s8.548-3.827,8.548-8.548V90.804h33.798v330.39H17.096
V154.261c0-4.721-3.827-8.548-8.548-8.548S0,149.54,0,154.261v275.481c0,4.721,3.827,8.548,8.548,8.548h50.894
c4.721,0,8.548-3.827,8.548-8.548v-28.306h376.02v28.306c0,4.721,3.827,8.548,8.548,8.548h50.894c4.721,0,8.548-3.827,8.548-8.548
V205.214C512,200.493,508.173,196.666,503.452,196.666z M187.183,138.496c34.259,20.174,61.801,47.717,81.975,81.975
c-3.333,5.662-6.892,11.161-10.615,16.45H115.834c-3.724-5.29-7.284-10.789-10.617-16.451
C125.376,186.223,152.915,158.681,187.183,138.496z M67.99,384.34v-81.183h302.976c4.721,0,8.548-3.827,8.548-8.548
c0-4.721-3.827-8.548-8.548-8.548H68.664c3.421-18.216,19.448-32.044,38.644-32.044h297.383c19.195,0,35.222,13.827,38.644,32.044
h-43.876c-4.721,0-8.548,3.827-8.548,8.548c0,4.721,3.827,8.548,8.548,8.548h44.551v81.183H67.99z M494.904,421.195h-33.798V213.762
h33.798V421.195z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

9
icons/frontdesk.svg Normal file
View File

@ -0,0 +1,9 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 512 512">
<g>
<path d="m496,120h-112c0-8.844-7.164-16-16-16v-16c0-26.469-21.531-48-48-48h-128c-26.469,0-48,21.531-48,48v16c-8.836,0-16,7.156-16,16h-112c-8.836,0-16,7.156-16,16v304c0,8.844 7.164,16 16,16h48c0,8.836 7.163,16 16,16h32c8.837,0 16-7.164 16-16h256c0,8.836 7.163,16 16,16h32c8.837,0 16-7.164 16-16h48c8.836,0 16-7.156 16-16v-304c0-8.844-7.164-16-16-16zm-320-32c0-8.828 7.18-16 16-16h128c8.82,0 16,7.172 16,16v16c-8.836,0-16,7.156-16,16h-128c0-8.844-7.164-16-16-16v-16zm304,336h-448v-272h448v272z"/>
<path d="m128,376c8.836,0 16-7.156 16-16v-144c0-8.844-7.164-16-16-16s-16,7.156-16,16v144c0,8.844 7.164,16 16,16z"/>
<path d="m384,376c8.836,0 16-7.156 16-16v-144c0-8.844-7.164-16-16-16s-16,7.156-16,16v144c0,8.844 7.164,16 16,16z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

1
icons/travel.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" ?><svg width="60px" height="60px" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><defs><style>.cls-1{fill:none;}.cls-2{fill:#3d3d63;}</style></defs><title/><g data-name="Layer 2" id="Layer_2"><g id="Icons"><g data-name="Air Tickets" id="Air_Tickets"><rect class="cls-1" height="60" width="60"/><path class="cls-2" d="M14.76,37.45a1,1,0,0,0-1,1v3.58a1,1,0,0,0,2.06,0V38.48A1,1,0,0,0,14.76,37.45Z"/><path class="cls-2" d="M15.79,31.33a1,1,0,0,0-2.06,0v3.58a1,1,0,0,0,2.06,0Z"/><path class="cls-2" d="M21.52,32.09h4.24a1,1,0,0,0,0-2.06H21.52a1,1,0,1,0,0,2.06Z"/><path class="cls-2" d="M35.93,38.36a1,1,0,0,0-1-1H21.52a1,1,0,1,0,0,2.06H34.9A1,1,0,0,0,35.93,38.36Z"/><path class="cls-2" d="M21.52,41.3a1,1,0,1,0,0,2.06h10a1,1,0,0,0,0-2.06Z"/><path class="cls-2" d="M56,33.42,51.12,21,54,18.17a4.49,4.49,0,0,0,1.29-2.8,3,3,0,0,0-.88-2.46v0A3.1,3.1,0,0,0,51.94,12a4.51,4.51,0,0,0-2.78,1.29l-2.9,2.9L33.89,11.35a1,1,0,0,0-1.11.23l-2.26,2.26a1,1,0,0,0-.3.79,1.06,1.06,0,0,0,.3.67.39.39,0,0,0,.1.08l2.47,1.92-.31.31a1,1,0,0,0,1.46,1.46l.49-.49,1.75,1.36-.32.32a1,1,0,0,0,1.46,1.46l.5-.5,1.75,1.36L36.49,26l-.53.57-3.27-1.26a1,1,0,0,0-1.1.24L30.14,27a1,1,0,0,0,0,1.46l3.07,3.07c-.05.18-.11.36-.15.54a1.83,1.83,0,0,0,2.22,2.22l.53-.15,3.08,3.07a1,1,0,0,0,1.45,0l1.46-1.46a1,1,0,0,0,.23-1.1l-1.25-3.27c.19-.17.38-.34.56-.52l3.38-3.39,1.37,1.76-.5.49a1,1,0,0,0,0,1.46,1,1,0,0,0,1.46,0l.31-.31,1.37,1.75-.49.49a1,1,0,0,0,1.46,1.46l.3-.31,1.92,2.47.09.1a1.09,1.09,0,0,0,.66.3,1,1,0,0,0,.8-.3l2.26-2.27A1,1,0,0,0,56,33.42ZM34,29.4l-1.71-1.71.26-.25,2.1.8A13.2,13.2,0,0,0,34,29.4ZM32.8,14.47l1-1,10.91,4.27-3.33,3.33ZM39.61,35l-1.7-1.7c.39-.2.78-.42,1.15-.65l.81,2.1Zm.27-5.62a11.07,11.07,0,0,1-4.72,2.79A11,11,0,0,1,38,27.42L50.62,14.75a2.42,2.42,0,0,1,1.5-.7,1,1,0,0,1,.81.3h0a1,1,0,0,1,.28.88,2.33,2.33,0,0,1-.69,1.47ZM52.83,34.5,46.19,26l3.34-3.33,4.26,10.91Z"/><path class="cls-2" d="M21.52,32.09h4.24a1,1,0,0,0,0-2.06H21.52a1,1,0,1,0,0,2.06Z"/><path class="cls-2" d="M20.49,38.36a1,1,0,0,0,1,1H34.89a1,1,0,1,0,0-2.06H21.52A1,1,0,0,0,20.49,38.36Z"/><path class="cls-2" d="M21.52,41.3a1,1,0,1,0,0,2.06h10a1,1,0,1,0,0-2.06Z"/><path class="cls-2" d="M49.82,39.56a1,1,0,0,0-1,1v5.73a.35.35,0,0,1-.35.34H7.06l1.51-2a1,1,0,0,0,0-1.24l-2.28-3,2.28-3a1,1,0,0,0,0-1.23L6.29,33,8.57,30a1,1,0,0,0,0-1.23l-1.51-2H24.9a1,1,0,1,0,0-2.06H11.09l.9-4.23L29,24a1,1,0,0,0,.43-2l-17.3-3.68a1.72,1.72,0,0,0-2,1.32L9,24.67H5a1,1,0,0,0-.83,1.65l2.29,3-2.29,3a1.05,1.05,0,0,0,0,1.24L6.46,36.7l-2.29,3a1.05,1.05,0,0,0,0,1.24L6.46,44l-2.29,3a1,1,0,0,0-.09,1.07,1,1,0,0,0,.92.58H48.44a2.41,2.41,0,0,0,2.41-2.41V40.59A1,1,0,0,0,49.82,39.56Z"/></g></g></g></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,5 +1,5 @@
[tryton]
version=6.0.8
version=6.0.9
depends:
party
company

View File

@ -43,19 +43,21 @@ this repository contains the full copyright notices and license terms. -->
<field name="origin_country"/>
<label name="target_country"/>
<field name="target_country"/>
<label name="total_commission"/>
<field name="total_commission"/>
<label name="commission_amount"/>
<field name="commission_amount"/>
<label name="invoice_line"/>
<field name="invoice_line"/>
<separator name="notes" colspan="4"/>
<field name="notes" colspan="4"/>
</page>
</notebook>
<group col="6" colspan="6" id="state_buttons">
<group col="8" colspan="6" id="state_buttons">
<label name="registration_state"/>
<field name="registration_state"/>
<label name="total_amount"/>
<field name="total_amount"/>
<label name="total_balance"/>
<field name="total_balance"/>
<label name="to_invoice"/>
<field name="to_invoice"/>
<button name="check_in" string="Check In"/>