Add data function available_by_cl... and add apps

This commit is contained in:
VIctor RUiz 2023-10-23 10:11:34 -05:00
parent 8af7575f29
commit ae920fa216
5 changed files with 49 additions and 3 deletions

View File

@ -96,6 +96,7 @@ def register():
dash.AppHousekeeping, dash.AppHousekeeping,
dash.AppWebCheckIn, dash.AppWebCheckIn,
dash.AppBooking, dash.AppBooking,
dash.AppWebBooking,
invoice.InvoiceLine, invoice.InvoiceLine,
invoice.Invoice, invoice.Invoice,
room.HotelTask, room.HotelTask,
@ -110,6 +111,7 @@ def register():
rate_plan.RatePlan, rate_plan.RatePlan,
rate_plan.RatePlanRule, rate_plan.RatePlanRule,
siat.SiatSyncStart, siat.SiatSyncStart,
dash.AppWebMelHous,
module='hotel', type_='model') module='hotel', type_='model')
Pool.register( Pool.register(
booking.BookingReport, booking.BookingReport,

13
dash.py
View File

@ -16,6 +16,8 @@ class DashApp(metaclass=PoolMeta):
"dash.app.housekeeping", "dash.app.housekeeping",
"dash.app.web_checkin", "dash.app.web_checkin",
"dash.app.booking", "dash.app.booking",
"dash.app.web_booking",
"dash.app.web_melhous",
] ]
) )
return origins return origins
@ -29,6 +31,8 @@ class DashApp(metaclass=PoolMeta):
("housekeeping", "Housekeeping"), ("housekeeping", "Housekeeping"),
("web_checkin", "Web Checkin"), ("web_checkin", "Web Checkin"),
("booking", "Booking"), ("booking", "Booking"),
("web_booking", "Web Booking"),
("web_melhous", "Web Melhous"),
] ]
) )
return options return options
@ -52,3 +56,12 @@ class AppWebCheckIn(DashAppBase):
class AppBooking(DashAppBase): class AppBooking(DashAppBase):
"App Booking" "App Booking"
__name__ = "dash.app.booking" __name__ = "dash.app.booking"
class AppWebBooking(DashAppBase):
"App Web Booking"
__name__ = "dash.app.web_booking"
class AppWebMelHous(DashAppBase):
"App Web Melhous"
__name__ = "dash.app.web_melhous"

View File

@ -95,5 +95,30 @@ this repository contains the full copyright notices and license terms. -->
<field name="method">report_month_occupancy_rate</field> <field name="method">report_month_occupancy_rate</field>
</record> </record>
<record model="dash.app.web_booking" id="dash_app_web_booking">
<field name="company">1</field>
<field name="icon">key</field>
<field name="kind">external</field>
</record>
<record model="dash.app" id="app_web_booking">
<field name="name">Web Booking</field>
<field name="origin">dash.app.web_booking,1</field>
<field name="active">True</field>
<field name="app_name">web_booking</field>
</record>
<record model="dash.app.web_melhous" id="dash_app_web_melhous">
<field name="company">1</field>
<field name="icon">key</field>
<field name="kind">external</field>
</record>
<record model="dash.app" id="app_web_melhous">
<field name="name">Web Melhous</field>
<field name="origin">dash.app.web_melhous,1</field>
<field name="active">True</field>
<field name="app_name">web_melhous</field>
</record>
</data> </data>
</tryton> </tryton>

View File

@ -192,14 +192,17 @@ class Room(Workflow, ModelSQL, ModelView):
product = room.main_accommodation.products[0] product = room.main_accommodation.products[0]
_room = { _room = {
"id": room.id, "id": room.id,
"name": room.name "name": room.name,
"max_accommodation": room.max_accommodation,
"amenities": [{"name": ame.name, "type_icon": ame.type_icon} for ame in room.amenities]
} }
try: try:
clssf[product.id]['available'].append(1) clssf[product.id]['available'].append(1)
clssf[product.id]['rooms'].append(_room) clssf[product.id]['rooms'].append(_room)
except: except:
clssf[product.id] = { clssf[product.id] = {
"product": {"id": product.id, "name": product.name}, "product": {"id": product.id, "name": product.name, "images": [img.image_url for img in product.images]},
"sale_price_taxed": product.sale_price_taxed, "sale_price_taxed": product.sale_price_taxed,
"available": [1], "available": [1],
"rooms": [_room], "rooms": [_room],
@ -315,6 +318,7 @@ class Amenities(ModelSQL, ModelView):
__name__ = 'hotel.amenities' __name__ = 'hotel.amenities'
_rec_name = 'name' _rec_name = 'name'
name = fields.Char('Name', required=True) name = fields.Char('Name', required=True)
type_icon = fields.Char('Type icon')
notes = fields.Text('Notes') notes = fields.Text('Notes')
type = fields.Selection([ type = fields.Selection([
('', ''), ('', ''),

View File

@ -6,6 +6,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="name"/> <field name="name"/>
<label name="type"/> <label name="type"/>
<field name="type"/> <field name="type"/>
<label name="type_icon"/>
<field name="type_icon"/>
<separator name="notes" colspan="4"/> <separator name="notes" colspan="4"/>
<field name="notes" colspan="4"/> <field name="notes" colspan="4"/>
<field name="cleaning_days" colspan="4" <field name="cleaning_days" colspan="4"