Add breakfast to booking

This commit is contained in:
Oscar 2021-09-16 12:47:03 -05:00
parent c0df7de168
commit 4b5f184129
8 changed files with 492 additions and 456 deletions

View File

@ -28,6 +28,7 @@ def register():
room.Amenities,
room.RoomAmenities,
product.Template,
product.PriceList,
city.MigrationCity,
operation.Operation,
operation.OperationLine,
@ -46,11 +47,9 @@ def register():
channel.ChannelTax,
booking.Guest,
booking.SelectRoomsAsk,
# party.CreateGuestStart,
booking.BookingVoucher,
booking.RoomsOccupancyStart,
booking.BookingForecastStart,
# voucher.AdvanceVoucherStart,
operation.OpenMigrationStart,
operation.CheckOutOperationFailed,
operation.ChangeRoomStart,
@ -101,5 +100,4 @@ def register():
booking.GuestsList,
sale.InvoiceIncomeDaily,
party.CreateGuest,
# voucher.AdvanceVoucher,
module='hotel', type_='wizard')

View File

@ -220,8 +220,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'get_total_advance')
pending_to_pay = fields.Function(fields.Numeric('Pending to Pay'),
'get_pending_to_pay')
# operations = fields.Many2Many('hotel.booking-hotel.operation', 'booking',
# 'sale', 'Sales', readonly=True)
breakfast_included = fields.Boolean('Breakfast Included')
@classmethod
def __setup__(cls):
@ -446,7 +445,6 @@ class Booking(Workflow, ModelSQL, ModelView):
# for line in record.lines:
# Line.write([line], {'registration_state_': 'check_out'})
@classmethod
@ModelView.button
def send_email(cls, records):
@ -668,10 +666,13 @@ class Booking(Workflow, ModelSQL, ModelView):
if email:
Template.send(config.booking_email_template, self, email)
else:
self.get_message('El usuario no tiene un correo asociado.')
raise UserError(gettext('El usuario no tiene un correo asociado'))
def get_message(self, message):
raise AccessError(gettext('hotel.msg_error', s=message))
@fields.depends('price_list', 'breakfast_included')
def on_change_price_list(self):
print('Aquiaaaaaaa')
if self.price_list:
self.breakfast_included = self.price_list.breakfast_included
class BookingLine(ModelSQL, ModelView):

View File

@ -93,7 +93,10 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window.domain" id="act_booking_form_domain_no_show">
<field name="name">No Show</field>
<field name="sequence" eval="50"/>
<field name="domain" eval="[('registration_state', '=', 'no_show')]" pyson="1"/>
<field name="domain" eval="['OR',
[('registration_state', '=', 'no_show')],
[('state', '=', 'cancelled')]
]" pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_booking_form"/>
</record>

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,11 @@ class Template(metaclass=PoolMeta):
__name__ = 'product.template'
kind = fields.Selection(KIND, 'Kind')
channel_code = fields.Char('Channel Code')
accommodation_capacity = fields.Integer('Accommodation Capacity', states={
'invisible': Eval('kind') != 'accommodation',
})
accommodation_capacity = fields.Integer('Accommodation Capacity',
states={'invisible': Eval('kind') != 'accommodation'}
)
class PriceList(metaclass=PoolMeta):
__name__ = 'product.price_list'
breakfast_included = fields.Boolean('Breakfast Included')

View File

@ -16,5 +16,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">template_tree</field>
</record>
<record model="ir.ui.view" id="price_list_view_form">
<field name="model">product.price_list</field>
<field name="inherit" ref="product_price_list.price_list_view_form"/>
<field name="name">price_list_form</field>
</record>
</data>
</tryton>

View File

@ -18,8 +18,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="payment_term"/>
<label name="registration_card"/>
<field name="registration_card"/>
<label name="cancellation_policy"/>
<field name="cancellation_policy" widget="selection"/>
<label name="media"/>
<field name="media"/>
<label name="party_seller"/>
@ -28,8 +26,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="taxes_exception"/>
<label name="plan"/>
<field name="plan"/>
<label name="breakfast_included"/>
<field name="breakfast_included"/>
<button name="select_rooms" string="Select Rooms"
icon="tryton-open"/>
icon="tryton-open" colspan="2"/>
<button name="send_email" string="Send Email"
icon="tryton-open" colspan="2"/>
<notebook colspan="6">
@ -46,6 +46,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="currency"/>
<label name="company"/>
<field name="company"/>
<label name="cancellation_policy"/>
<field name="cancellation_policy" widget="selection"/>
<label name="person_num"/>
<field name="person_num"/>
<label name="vehicles_num"/>

9
view/price_list_form.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='unit']" position="after">
<label name="breakfast_included"/>
<field name="breakfast_included"/>
</xpath>
</data>